What is the best way to remove leading and trailing zeros from C++ string formatters that use %f. There's a similar question Avoid trailing zeroes in printf() but that just says to use the %g formatter.
The %g formatter will output 600000000009 as 6e+11
I just want to remove the leading and trailing zeros from %f eg:
- 000.001 -> 0.001
- 00.100 -> 0.100
- .10 -> 0.1
- 2.0 -> 2
Any thoughts/suggestions welcome. Thanks.