dart:core
庫中num.toStringAsExponential
方法的用法介紹如下。
用法:
String toStringAsExponential(
[int? fractionDigits]
)
此數字的 index string-representation。
在計算字符串表示之前將此數字轉換為 double。
如果給出fractionDigits
,那麽它必須是一個滿足:0 <= fractionDigits <= 20
的整數。在這種情況下,字符串在小數點後正好包含fractionDigits
。否則,如果沒有該參數,則返回的字符串將使用準確表示此數字的最短位數。
如果fractionDigits
等於0,則省略小數點。例子:
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
相關用法
- Dart num.toStringAsPrecision用法及代碼示例
- Dart num.toStringAsFixed用法及代碼示例
- Dart num.toString用法及代碼示例
- Dart num.tryParse用法及代碼示例
- Dart num.sign用法及代碼示例
- Dart num.abs用法及代碼示例
- Dart num.remainder用法及代碼示例
- Dart num.compareTo用法及代碼示例
- Dart num.operator_modulo用法及代碼示例
- Dart num.parse用法及代碼示例
- Dart num.clamp用法及代碼示例
- Dart MapMixin.containsKey用法及代碼示例
- Dart Iterator用法及代碼示例
- Dart AttributeClassSet.intersection用法及代碼示例
- Dart TransformList.last用法及代碼示例
- Dart FileList.first用法及代碼示例
- Dart CanvasRenderingContext2D.drawImageScaledFromSource用法及代碼示例
- Dart FileList.length用法及代碼示例
- Dart Iterable.takeWhile用法及代碼示例
- Dart LinkedHashMap用法及代碼示例
- Dart RegExp.pattern用法及代碼示例
- Dart StreamTransformer構造函數用法及代碼示例
- Dart JsArray.removeAt用法及代碼示例
- Dart ListMixin.expand用法及代碼示例
- Dart UriData.parse用法及代碼示例
注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 toStringAsExponential method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。