Skip to content

epleone/CodeCalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

391 Commits

Repository files navigation

CodeCalc

License: MIT

一个支持代码风格计算的 utools 插件。

主要功能

变量和赋值:

  • 基本赋值:a = 5
  • 复合赋值:+=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=, >>>=

基本运算:

  • 算术运算:+, -, *, /, //, %, **
  • 位运算:&, |, ^, ~, <<, >>, >>>
  • 别名支持:and, or, not, x(未定义变量x时可以用作乘号)

数学函数:

  • 三角函数:sin, cos, tan, asin, acos, atan
  • 对数指数:log, ln, exp, pow, sqrt
  • 其他:abs, max, min

角度转换:

  • 角度转弧度:rad(45)45°.rad
  • 弧度转角度:deg(PI).deg

字符串操作:

  • 字符串:s = "Hello", 支持 + 连接,如 "Hello" + "World"
  • 字符串属性:.length, .upper, .lower
  • base64 编解码:base64(s).base64, unbase64(s).unbase64

进制转换:

  • 输入:0b(二进制), 0o(八进制), 0x(十六进制)
  • 输出:.bin, .oct, .hex

常量:

  • π, PI, pi: 3.14159...
  • E,e: 2.71828...

时间戳:

  • @now: 当前时间戳
  • @today: 今天日期
  • @2000-06-01 11:30:01: 指定日期时间
  • @now + #1w2d3h: 当前时间加1周2天3小时
  • @now - #1y2m3d5h7s: 当前时间减1年2月3天5小时7秒

矩阵和向量:

  • 向量:[1, 2, 3]
  • 矩阵:{1, 2; 3 4}
  • eye(3): 生成3x3单位矩阵
  • diag([1, 2, 3]): 生成对角矩阵
  • ones(2, 3): 生成2x3全1矩阵
  • zeros(2, 3): 生成2x3全0矩阵
  • random(2, 3): 生成2x3随机矩阵
  • 矩阵和向量支持 加 减 乘 除, 幂运算(element-wise)
  • 矩阵乘法
  • 矩阵转置
  • 矩阵求逆
  • 矩阵特征值

快捷键

  • Ctrl + / or ⌘ + / 显示快捷键面板

Tip

详细文档请参考 CodeCalc 文档

Credits

灵感来源:itribs/rcalculator