EngineeringFormatter.Format(string) - YiZhang-Paul/Mock_Up_Calculator GitHub Wiki
Namespace: FormatterClassLibrary
Description: Format a number represented as string to scientific notation.
Parameters | Description |
---|---|
number<string> | number to be formatted, represented as string |
Returns | Description |
---|---|
string | formatted number |
Exceptions | Cause |
---|---|
ArgumentNullException | number is null |
FormatException | number is empty or does not represent valid number |
OverflowException | number is larger than decimal.MaxValue |
Examples:
var formatter = new EngineeringFormatter();
Console.WriteLine(formatter.Format("100")); //1.e+2
Console.WriteLine(formatter.Format("1000")); //1.e+3
Console.WriteLine(formatter.Format("1000000")); //1.e+6
Console.WriteLine(formatter.Format("-1000000.999")); //-1.000000999e+6