Hi,
I'm getting doubles with 4 decimal places, however when the last two digits are 00, I want to format to .00 but if the 3rd or 4th decimal place contains a value different to 0 I want to leave the 4 decimal places. Is there an easy way to do this with String.Format or would I have to evaluate the values and use the appropriate string formatter
Thanks,
Tom

String.Format 10.0000 to 10.00 but keep 10.0001
BTBL
See http://msdn2.microsoft.com/en-us/library/system.globalization.numberformatinfo.numberdecimaldigits.aspx
P Santosh
Hello.
> or would I have to evaluate the values and use the appropriate string formatter
Yes. You must evaluate C#: (v % 0.01) or VB: (v mod 0.01) for zero (or in fact close to zero, but never mind).
Hope this helps.
IS dude
Rosh K Mathews
samsonknight
Andy Larter
values % 0.01 gives me:
26,91 = 0,00999999999999958
26,8 = 1,52655665885959E-16
26,79 = 0,00999999999999859
-0,07 = -5,20417042793042E-18
26,79 = 0,00999999999999859
so how should I tell if it's a 2 or 4 decimal place value
AKS