I need to return the string representation of a double in decimal notation rather than scientific and I used a modified version of the accepted solution here:
Double ToString - No Scientific Notation
private static readonly string format = "." + new string('#', 324);
foo.ToString(format);
This works well other than for a value that equals zero i.e. 0, 0.0, 0.000 etc where it returns an empty string.
What would be the easiest way to return a string representing 0 for any value of zero.
I don't mind if the string is 0 or 0.0 etc as long as it is numerical and not scientific.
Edit: I know I could add a conditional statement to check if the string is empty but I am interested to see if there is a way to do it using string formatting.