LibUnicode: Parse numbers in number formats a bit more leniently

The parser was previously expecting number sections within a pattern to
start with "#", but they may also begin with "0".
This commit is contained in:
Timothy Flynn 2021-11-12 15:49:14 -05:00 committed by Linus Groh
parent f88b4dfb58
commit 6cfd63e5bd
Notes: sideshowbarker 2024-07-18 01:12:12 +09:00

View File

@ -90,7 +90,7 @@ static void parse_number_pattern(String pattern, UnicodeLocaleData& locale_data,
{ "¤"sv, "{currencyCode}"sv }, // U+00A4 Currency Sign
};
if (auto start_number_index = pattern.find('#'); start_number_index.has_value()) {
if (auto start_number_index = pattern.find_any_of("#0"sv, String::SearchDirection::Forward); start_number_index.has_value()) {
auto end_number_index = *start_number_index + 1;
for (; end_number_index < pattern.length(); ++end_number_index) {