C#中格式化数字输出,使用NumberFormatInfo.NumberGroupSeparator 属性
2007-10-20 10:53
846 查看
C#
using System; using System.Globalization; class NumberFormatInfoSample { public static void Main() { // Gets a NumberFormatInfo associated with the en-US culture. NumberFormatInfo nfi = new CultureInfo( "en-US", false ).NumberFormat; // Displays a value with the default separator (","). Int64 myInt = 123456789; Console.WriteLine( myInt.ToString( "N", nfi ) ); // Displays the same value with a blank as the separator. nfi.NumberGroupSeparator = " "; Console.WriteLine( myInt.ToString( "N", nfi ) ); } } /* This code produces the following output. 123,456,789.00 123 456 789.00 */
相关文章推荐
- C#:String.Format数字格式化输出 {0:N2} {0:D2} {0:C2}...
- c# String.Format数字格式化输出 如 {0:N2} {0:D2} {0:C2}
- C#:String.Format数字格式化输出
- Struts1.x中 bean:write format 属性格式化输出日期,数字
- C# string.Format数字格式化输出
- C#:String.Format数字格式化输出
- C#:String.Format数字格式化输出 {0:N2} {0:D2} {0:C2}...
- C# String.Format 数字格式化输出
- 使用NumberFormat格式化数字
- 【转】C#:String.Format数字格式化输出
- accounting.formatNumber/Money的使用格式化货币、数字
- 【转】C# String.Format数字格式化输出各种转换{0:N2} {0:D2} {0:C2}...
- 【转】C#:String.Format数字格式化输出
- 使用NumberFormat格式化数字
- C#:String.Format数字格式化输出
- 数字格式化输出NumberFormat
- C#:String.Format数字格式化输出
- C#:String.Format数字格式化输出
- C#,String.Format,数字格式化输出 ,format
- C#:String.Format数字格式化输出