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:
parent
86a1ff5204
commit
ae66188d43
Notes:
sideshowbarker
2024-07-18 01:15:51 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/ae66188d43a Pull-request: https://github.com/SerenityOS/serenity/pull/10873 Reviewed-by: https://github.com/linusg
1 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue