Files
apskel-pos-flutter-v2/lib/common/extension/double_extension.dart
T

23 lines
578 B
Dart
Raw Normal View History

2025-10-25 00:13:43 +07:00
part of 'extension.dart';
extension DoubleExt on double {
String get currencyFormatRp => NumberFormat.currency(
locale: 'id',
symbol: 'Rp. ',
decimalDigits: 0,
).format(this);
String get currencyFormatRpV2 => NumberFormat.currency(
locale: 'id',
symbol: 'Rp ',
decimalDigits: 0,
).format(this);
}
2026-09-06 23:03:31 +07:00
extension WeightExt on double {
/// Format berat gaya Indonesia: koma desimal, tanpa nol di belakang.
/// `4.2` → `4,2`, `4.237` → `4,237`, `5.0` → `5`.
String get weightFormat =>
NumberFormat('#,##0.###', 'id').format(this);
}