| 1 | String _smartAmountSanitizer(String amount) { |
| 2 | if (amount.contains(RegExp(r'^(?=.*[.])(?=.*,).*$'))) { |
| 3 | if (amount.indexOf(".") > amount.indexOf(",")) { |
| 4 | amount = amount.replaceAll(",", ""); |
| 5 | } else { |
| 6 | amount = amount.replaceAll(".", ""); |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | return amount.replaceAll(",", "."); |
| 11 | } |
| 12 | |
| 13 | extension SanitizerUserAmounts on String { |
| 14 | String sanitized() => _smartAmountSanitizer(this); |
| 15 | } |