In Python I can do something like this
f = "{:6e}"
print(f.format(5)) # '5.000000e+00'
I can't figure out how to do something like this in Nim. As far as I can tell this is not possible using strformat. Can someone point me in the right direction?
Thanks.
@woggy, you could also try a library like this one: https://github.com/kaushalmodi/strfmt
Looking at the docs, it does support runtime evaluation.
Thanks peeps.
What I really wanted is the format function in the strfmt library mentioned above. I went with formatFloat for now as it does what I want and is available in the standard library. The compile time fmt strings are fantastic but I hope in the future something like format will also be in the standard library.