Dart

Double형 소수점 이하자리 끊기!

Michelle Hwang 2021. 3. 24. 11:29

# toStringAsFixed()

String toStringAsFixed(int fractionDigits);
assert(123.456.toStringAsFixed(2) == '123.46');

 

api.dart.dev/stable/2.12.2/dart-core/num/toStringAsFixed.html

 

toStringAsFixed method - num class - dart:core library - Dart API

String toStringAsFixed (int fractionDigits ) A decimal-point string-representation of this number. Converts this number to a double before computing the string representation, as by toDouble. If the absolute value of this is greater then or equal to 10^21

api.dart.dev

 

'Dart' 카테고리의 다른 글

Class 용어정리  (0) 2021.03.26
Lists  (0) 2021.03.25
where  (0) 2021.03.24
람다식  (0) 2021.03.24
선택 매개변수  (0) 2021.03.24