问题
I want to convert double to scientific notation like this:
-0.00752382528 => -.752383E-1
can i do this with .ToString() or Regex?
回答1:
You can either use the standard format string for scientific notation:
(-0.00752382528).ToString("E5") // returns "-7.52383E-003"
or if you don't want the leading zeros in the exponent, use a custom string:
(-0.00752382528).ToString("0.00000E0") // returns "-7.52383E-3"
来源:https://stackoverflow.com/questions/25851179/convert-double-to-scientific-notation-with-specific-number-after-decimal-points