C#数值格式
示例
//整数类型为十六进制
string.Format("Hexadecimal: byte2: {0:x2}; byte4: {0:X4}; char: {1:x2}", 123, (int)'A');
//带有千位分隔符的整数
string.Format("Integer, thousand sep.: {0:#,#}; fixed length: >{0,10:#,#}<", 1234567);
//带有前导零的整数
string.Format("Integer, leading zeroes: {0:00}; ", 1);
//小数点
string.Format("Decimal, fixed precision: {0:0.000}; as percents: {0:0.00%}", 0.12);输出:
Hexadecimal: byte2: 7b; byte4: 007B; char: 41 Integer, thousand sep.: 1,234,567; fixed length: > 1,234,567< Integer, leading zeroes: 01; Decimal, fixed precision: 0.120; as percents: 12.00%
热门推荐
1 如何训练狗狗不叫
2 训练狗狗不叫
3 训练狗狗随行
4 怎么训练狗狗不叫
7 训练比熊狗狗教程
10 上海狗狗训练
11 怎么训练狗狗上厕所
12 训练狗狗趴下
13 狗狗服从训练
14 训练狗狗拒食
15 训练狗狗笑
16 训练狗狗大便
17 训练狗狗立
18 训练狗狗捡东西