I need to convert a decimal to a string with N decimals (two or four) and NO thousand separator:
\'XXXXXXX (dot) DDDDD\'
The problem with CultureInfo.I
For a decimal
, use the ToString method, and specify the Invariant culture to get a period as decimal separator:
value.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)
The long
type is an integer, so there is no fraction part. You can just format it into a string and add some zeros afterwards:
value.ToString() + ".00"