mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
16 lines
406 B
Dart
16 lines
406 B
Dart
String _smartAmountSanitizer(String amount) {
|
|
if (amount.contains(RegExp(r'^(?=.*[.])(?=.*,).*$'))) {
|
|
if (amount.indexOf(".") > amount.indexOf(",")) {
|
|
amount = amount.replaceAll(",", "");
|
|
} else {
|
|
amount = amount.replaceAll(".", "");
|
|
}
|
|
}
|
|
|
|
return amount.replaceAll(",", ".");
|
|
}
|
|
|
|
extension SanitizerUserAmounts on String {
|
|
String sanitized() => _smartAmountSanitizer(this);
|
|
}
|