Why Java Character.toUpperCase/toLowerCase has no Locale parameter like String.toUpperCase/toLowerCase
As the Javadoc says:
In general, String.toUpperCase() should be used to map characters to uppercase. String case mapping methods have several benefits over Character case mapping methods. String case mapping methods can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whereas the Character case mapping methods cannot.
So use String.toUppercase()
From the Character#toUpperCase(int)
Javadoc,
In general,
String.toUpperCase()
should be used to map characters to uppercase.String
case mapping methods have several benefits overCharacter
case mapping methods.String
case mapping methods can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whereas theCharacter
case mapping methods cannot.
So, the answer is your second example (String.toUpperCase
)