feat:参照研听的基础工程
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
String formatCny(num value) {
|
||||
final fixed = value.toStringAsFixed(2);
|
||||
final parts = fixed.split('.');
|
||||
final whole = parts.first.replaceAllMapped(
|
||||
RegExp(r'(\d)(?=(\d{3})+(?!\d))'),
|
||||
(match) => '${match[1]},',
|
||||
);
|
||||
return '¥$whole.${parts.last}';
|
||||
}
|
||||
|
||||
String formatGram(num value) => '${value.toStringAsFixed(2)}g';
|
||||
Reference in New Issue
Block a user