parse static method
Parses a formatted number string back to a decimal number.
This method takes a formatted formattedNumber string and a locale string,
and parses the formatted string back into a decimal number. The formatted
number string must match the locale's formatting pattern (e.g., commas,
periods, spaces, etc.).
Example:
Number.parse('1,234,567.89', 'en_US');
Output: 1234567.89
Example with a different locale:
Number.parse('1.234.567,89', 'de_DE');
Output: 1234567.89
formattedNumber The formatted number string to be parsed.
locale The locale to use for parsing.
Returns a num representing the parsed number.
Implementation
static num parse(String formattedNumber, [String? locale]) {
try {
return Andomie.decimalParser(locale, formattedNumber);
} catch (_) {
return parse(formattedNumber, Number.locale(formattedNumber));
}
}