int parseFancyNumber(String input) {
input = input.trim();
if (input.contains(',')) {
input = input.replaceAll(',', '');
}
const multipliers = {'h': 100, 'k': 1000, 'ht': 100000, 'm': 1000000};
int value;
if (!multipliers.keys.any((m) => input.endsWith(m))) {
value = int.parse(input);
} else {
final m = multipliers.keys.firstWhere((m) => input.endsWith(m));
input = input.substring(0, input.length - m.length);
value = num.parse(input) * multipliers[m]! as int;
}
return value;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4