c# - Float Formatting -



c# - Float Formatting -

i need format float value string given below

1.0e11 -- 1.0e11 1.21 -- 1.21

when tried tostring("0.00") got next values:

1.0e11- "10000000000.00" 1.21 - 1.21

how can convert float value string exponential value, if has exponential?

string.format("{0:e4}", myfloat);

or

myfloat.tostring("e4"); // 4 number of decimal places

reference: http://blogs.msdn.com/b/kathykam/archive/2006/03/29/564426.aspx

c#

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -