I like to format all numbers like in math. is there a predefined function or is that just possible with substring and replace?
edit: my culture is de-ch
Best regards
Try this
int input = Convert.ToInt32("1700");
string result = String.Format("{0:##,##}", input);
Or this
Console.WriteLine(1700.ToString("##,##", new NumberFormatInfo() { NumberGroupSeparator = "'" }));
var numformat = new NumberFormatInfo {
NumberGroupSeparator = "'",
NumberGroupSizes = new int[] { 3 },
NumberDecimalSeparator = "."
};
Console.WriteLine(1000000.ToString("N",numformat));
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