I need first .(dot) then comma(,).
like, 1234567 this is an example number or money I want it like 1.234.567,00 can anybody give me an answer.
If the culture settings on the computer where the code is executed correspond with your wishes, you can simply use a ToString overload as:
double d = 1234567;
string res = d.ToString("#,##0.00"); //in the formatting, the comma always represents the group separator and the dot the decimal separator. The format part is culture independant and is replaced with the culture dependant values in runtime.
if the display has to be culture independent, you can use a specific numberformatinfo:
var nfi = new NumberFormatInfo { NumberDecimalSeparator = ",", NumberGroupSeparator = "." };
double d = 1234567;
string res = d.ToString("#,##0.00", nfi); //result will always be 1.234.567,00
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With