MadsKirkFoged/EngineeringUnits

ToString() without scientific notation

Closed this issue · 1 comments

If a unit has a large value (>10000) the .ToString() automatically displays the value with scientific notation. Is there a way to override this behavior?

You can use the formats:
https://github.com/MadsKirkFoged/EngineeringUnits?tab=readme-ov-file#what-are-my-options-for-outputting-to-a-string

Pressure LargeNumber = Pressure.FromBar(1000000);

string PrintOut = LargeNumber.ToString();  //1e+06 bar
string PrintOut2 = LargeNumber.ToString("S7"); //1000000 bar
string PrintOut3 = LargeNumber.ToString("G7"); //1000000 bar