我喜欢像数学一样格式化所有数字。是否有预定义的函数,或者只有子字符串和替换才有可能?
编辑:我的文化是 de-ch
最好的问候
最佳答案
试试这个
int input = Convert.ToInt32("1700");
string result = String.Format("{0:##,##}", input);
或者这个
Console.WriteLine(1700.ToString("##,##", new NumberFormatInfo() { NumberGroupSeparator = "'" }));
关于c# - 如何在 C# 中将 1700 格式化为 1'700 and 1000000 to 1' 000'000?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2100472/