Hey is there is simple way to show 12 as 12.00, when I convert it to string? I can't just add zeros, cause it also has inputs with digits, where only one 0 need to be added.
Some inputs and there espected outputs:
12 -> 12.00
1.3 -> 1.30
0.2 -> 0.2
3.454 -> 3.45
I have tried this:
String.Format("{0:0.00}", Regex.Replace(VerkaufspreisInput.Text, 12);
Output 12
It's the wrong function.
Thanks for help!
You can use ToString
with N2
, e.g.:
Console.WriteLine((12.00).ToString("N2"));
Will print 12.00
.