C# String Format [duplicate]
Possible Duplicate:
.NET String.Format() to add commas in thousands place for a number
Hello
I have money value like that
12345
123456
1234567
1234567,89
What i want is formate开发者_StackOverflow中文版d like this.
12,345
123,456
1,234,567
1,234,567, 89
How can i do that with String.Format ?
String.Format("{0:c}");
This will format your number like currency based on the client's locale configuration.
If your client's locale is in Europe it'll come out $12.134,45 because that's how it's done over there.
This is the preferred method of currency formatting, if you want to specifically just get the comma's and no $ you'll probably have to do it using "{0:#,##0}" or something along those lines.
Cool new way...
精彩评论