save before flutter upgrade
This commit is contained in:
12
lib/functions/money_format.dart
Normal file
12
lib/functions/money_format.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
String moneyFormat(double x) {
|
||||
List<String> parts = x.toString().split('.');
|
||||
RegExp re = RegExp(r'\B(?=(\d{3})+(?!\d))');
|
||||
|
||||
parts[0] = parts[0].replaceAll(re, ',');
|
||||
if (parts.length == 1) {
|
||||
parts.add('00');
|
||||
} else {
|
||||
parts[1] = parts[1].padRight(2, '0').substring(0, 2);
|
||||
}
|
||||
return parts.join('.');
|
||||
}
|
||||
Reference in New Issue
Block a user