[原创][连载]nim与python的异同2
文章目录
overload(方法重载)
-
python
不支持
-
nim
支持.和c++类似
基本类型转换
整数 → 文字列
-
使用整数(int/int8/int16/int32/64/uint/uint8/uint16/uint32/uint32)内置方法(由system引入)
let value:int64 = 99999 echo “this value is: $#”% $valueresult:
this value is: 99999 -
使用strformat进行格式化(由strformat引入&操作符)
let value:int64 = 99999 echo “this value is: $#”% &”{value<:可选格式文字列>}”- 没有格式文字列:
this value is: 99999 - 共10位,小数位2位,右对齐进行格式化
echo “this value is: $#”% &”{value:>10.2}”
result:
this value is: 0099999.00
- 没有格式文字列:

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论