String.Format几种用法
来源:互联网 发布:苏州教师网络培训平台 编辑:程序博客网 时间:2024/06/09 17:44
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几种用法
- String.Format 方法的几种定义
- string.format()用法
- string.Format的用法
- String format 用法
- string.Format()用法。
- String.Format() 的用法
- String.Format用法
- String.Format()的用法
- string.Format 用法一
- String.Format用法 收藏
- String.format()用法
- String.format()的用法
- String.Format用法
- string.Format用法
- C# string.format用法
- String.Format用法
- string.Format用法
- .Net Micro Framework开发板用户简明手册
- 以前的某个程序安装已在安装计算机上创建挂起文件操作(转载)
- 学Win32 汇编[2]: 最简单的 Win32 程序
- 快速内存比较函数CompareMem(Delphi SSE优化算法应用之二)
- 学 Win32 汇编[3]: 控制台下的几种输入、输出方式
- String.Format几种用法
- 额
- 110个oracle常用函数总结
- 重力小球
- [转]《给年轻工程师的十大忠告》
- sqlcommandbuilder进行数据更新
- 关于字符的一道很容易做错的题目
- 必须掌握的八个【cmd 命令行】
- 惠普中国CEO孙振耀退休感言