reports page
This commit is contained in:
22
frontend/pweb/lib/utils/report/amount_parts.dart
Normal file
22
frontend/pweb/lib/utils/report/amount_parts.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
AmountParts splitAmount(String value) {
|
||||
final trimmed = value.trim();
|
||||
if (trimmed.isEmpty || trimmed == '-') {
|
||||
return const AmountParts(amount: '-', currency: '');
|
||||
}
|
||||
final parts = trimmed.split(' ');
|
||||
if (parts.length < 2) {
|
||||
return AmountParts(amount: trimmed, currency: '');
|
||||
}
|
||||
final currency = parts.removeLast();
|
||||
return AmountParts(amount: parts.join(' '), currency: currency);
|
||||
}
|
||||
|
||||
class AmountParts {
|
||||
final String amount;
|
||||
final String currency;
|
||||
|
||||
const AmountParts({
|
||||
required this.amount,
|
||||
required this.currency,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user