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%
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短