Frage

When I display numbers as strings in scientific notation using tostring("E4"), the leading zeros are displayed so that the exponent is always three digits. How can I get rid of these leading zeros?

For example, I want this: "5.5E9", and not this: "5.5E+009".

War es hilfreich?

Lösung

Use a Custom Format string:

314159.ToString("#.###+E0")

Produces

3.142+E5
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top