W3cubDocs

/Dart 2

toStringAsExponential method

String toStringAsExponential ([int fractionDigits ])

Returns an exponential string-representation of this.

Converts this to a double before computing the string representation.

If fractionDigits is given then it must be an integer satisfying: 0 <= fractionDigits <= 20. In this case the string contains exactly fractionDigits after the decimal point. Otherwise, without the parameter, the returned string uses the shortest number of digits that accurately represent this.

If fractionDigits equals 0 then the decimal point is omitted. Examples:

1.toStringAsExponential();       // 1e+0
1.toStringAsExponential(3);      // 1.000e+0
123456.toStringAsExponential();  // 1.23456e+5
123456.toStringAsExponential(3); // 1.235e+5
123.toStringAsExponential(0);    // 1e+2

Implementation

String toStringAsExponential([int fractionDigits]);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-core/num/toStringAsExponential.html