Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to format the money using asian format

In India and other Asian countries money is formatted as following: The first three digits grouped in three then all other digits are grouped in pair of two. eg : 2,54,255.12 5,22,54,255.12 etc string money = String.Format("{0:#,##0.00}", 254255.12);

gives the output 254,255.12

but the output required is 2,54,255.12

like image 234
Thunder Avatar asked Nov 21 '25 04:11

Thunder


1 Answers

Use an appropriate CultureInfo and the "c" format specifier:

CultureInfo hindi = CultureInfo.CreateSpecificCulture("hi-IN");
string text = string.Format(hindi, "{0:c}", 254255.12);

Note that you should really use decimal rather than double for currency values, to avoid binary floating point issues.

like image 66
Jon Skeet Avatar answered Nov 23 '25 17:11

Jon Skeet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!