string.format的使用
2007-12-13 18:41
351 查看
string.format的使用
2007-11-29 16:22
2007-11-29 16:22
stringstr1 =string.Format("{0:N1}",56789); //result: 56,789.0 stringstr2 =string.Format("{0:N2}",56789); //result: 56,789.00 stringstr3 =string.Format("{0:N3}",56789); //result: 56,789.000 stringstr8 =string.Format("{0:F1}",56789); //result: 56789.0 stringstr9 =string.Format("{0:F2}",56789); //result: 56789.00 stringstr11 =(56789 / 100.0).ToString("#.##"); //result: 567.89 stringstr12 =(56789 / 100).ToString("#.##"); //result: 567 C 或 c 货币 Console.Write("{0:C}", 2.5); / 2.50 Console.Write("{0:C}", -2.5); //($2.50) D 或 d 十进制数 Console.Write("{0:D5}", 25); //00025 E 或 e 科学型 Console.Write("{0:E}", 250000); //2.500000E+005 F 或 f 固定点 Console.Write("{0:F2}", 25); //25.00 Console.Write("{0:F0}", 25); //25 G 或 g 常规 Console.Write("{0:G}", 2.5); //2.5 N 或 n 数字 Console.Write("{0:N}", 2500000); //2,500,000.00 X 或 x 十六进制 Console.Write("{0:X}", 250); //FA Console.Write("{0:X}", 0xffff); //FFFF
|
相关文章推荐
- String.Format使用方法
- JAVA String.format 方法使用介绍
- String.format 的使用
- JAVA字符串格式化-String.format()的使用
- JAVA字符串格式化-String.format()的使用
- String.format函数使用方法介绍
- JAVA String.format方法使用介绍
- JAVA字符串格式化-String.format()的使用
- JAVA字符串格式化-String.format()的使用
- JAVA字符串格式化-String.format()的使用 【补0】:System.out.printf("补0之后:%03d%n", 7);
- JAVA String.format 方法使用介绍
- Android 字符串转换String.format使用及String使用技巧
- JAVA字符串格式化-String.format()的使用
- ASP.NET设置数据格式与String.Format使用总结
- JAVA字符串格式化-String.format()的使用总结
- JAVA字符串格式化-String.format()的使用
- ASP.NET设置数据格式与String.Format使用总结
- maven项目中使用redis集群报错: java.lang.NumberFormatException: For input string: "7006@17006"
- JAVA String.format 方法使用介绍
- C# string.Format 格式化使用说明