LibUnicode: Capitialize generated identifiers in lieu of full title case

This isn't particularly important because this generates code that is
quite hidden from outside callers. But when viewing the generated code,
it's a bit nicer to read e.g. enum identifiers such as "MinusSign"
rather than "Minussign".
This commit is contained in:
Timothy Flynn 2021-10-24 08:44:29 -04:00 committed by Linus Groh
parent 86a1ff5204
commit ae66188d43
Notes: sideshowbarker 2024-07-18 01:15:51 +09:00

View file

@ -601,7 +601,9 @@ static String format_identifier(StringView owner, String identifier)
if (all_of(identifier, is_ascii_digit))
return String::formatted("{}_{}", owner[0], identifier);
return identifier.to_titlecase();
if (is_ascii_lower_alpha(identifier[0]))
return String::formatted("{:c}{}", to_ascii_uppercase(identifier[0]), identifier.substring_view(1));
return identifier;
}
static void generate_unicode_locale_header(Core::File& file, UnicodeLocaleData& locale_data)