2026-01-16 13:27:09 +07:00
|
|
|
part of 'extension.dart';
|
|
|
|
|
|
|
|
|
|
extension DoubleExt on double {
|
|
|
|
|
String get currencyFormatRpV2 => NumberFormat.currency(
|
|
|
|
|
locale: 'id',
|
|
|
|
|
symbol: 'Rp ',
|
|
|
|
|
decimalDigits: 0,
|
|
|
|
|
).format(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension StringX on String {
|
|
|
|
|
String get currencyFormatRp {
|
|
|
|
|
final parsedValue = int.tryParse(this) ?? 0;
|
|
|
|
|
return NumberFormat.currency(
|
|
|
|
|
locale: 'id',
|
|
|
|
|
symbol: 'Rp ',
|
|
|
|
|
decimalDigits: 0,
|
|
|
|
|
).format(parsedValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension IntegerExt on int {
|
|
|
|
|
String get currencyFormatRp => NumberFormat.currency(
|
|
|
|
|
locale: 'id',
|
|
|
|
|
symbol: 'Rp ',
|
|
|
|
|
decimalDigits: 0,
|
|
|
|
|
).format(this);
|
2026-10-01 01:43:22 +07:00
|
|
|
|
|
|
|
|
/// Format ribuan Indonesia tanpa simbol: 12.500
|
|
|
|
|
String get thousandFormat => NumberFormat.decimalPattern('id').format(this);
|
2026-01-16 13:27:09 +07:00
|
|
|
}
|