Format 根据当前区域文化来显示带有货币符号的数字。
1,显示带美元货币符号的数字。
如图:
代码如下:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 int digital = 123456;
2 CultureInfo di = new CultureInfo("en");
3 Console.WriteLine(digital.ToString("c",di));
2 CultureInfo di = new CultureInfo("en");
3 Console.WriteLine(digital.ToString("c",di));
2.显示带人民币货币符号的数字。
代码如下:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 int digital = 123456;
2 CultureInfo di = new CultureInfo("zh-chs");
3 Console.WriteLine(digital.ToString("c",di));
2 CultureInfo di = new CultureInfo("zh-chs");
3 Console.WriteLine(digital.ToString("c",di));
3.显示带英镑符号的数字
代码如下:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 int digital = 123456;
2 CultureInfo di = new CultureInfo("de");
3 Console.WriteLine(digital.ToString("c",di));
2 CultureInfo di = new CultureInfo("de");
3 Console.WriteLine(digital.ToString("c",di));