I Have used following code to format decimals
return string.Format(CultureInfo.CreateSpecificCulture("nb-NO"), "{0:N3}", decVal);
If the decVal do not contain decimals I do not want to show decimal points but I want to show the figure with the correct formatting without zero s , How to perform this ?
You can use custom numeric format like:
return string.Format(CultureInfo.CreateSpecificCulture("nb-NO"), "{0:0.###}", decVal);
You may want to read about standard numeric formats and custom numeric formats
EDIT:
To handle the thousands separators you could use:
return string.Format(CultureInfo.CreateSpecificCulture("nb-NO"), "{0:#,0.###}", decVal);
But, to handle some specific cases you'd better to implement formats like it is described in this SO thread.
P.S.: Thanks @Luaan for the (0.###);
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