I was refactoring some of my old code and then I found out that I\'d used Character.toTitleCase()
method at some point and couldn\'t help myself wondering if
Standard ASCII characters are so boring! Here's something more exciting:
System.out.println(Character.toTitleCase('dz')); // Dz
System.out.println(Character.toUpperCase('dz')); // DZ
Live demo.
I don't really see any "real" differences here and I think it's best not to overthink small details. I wanna point out this only line here which should help with the "issue" here.
In general, String.toUpperCase()
should be used to map characters to uppercase. String case mapping methods have several benefits over Character case mapping methods.
Documentation String.toUpperCase()
: https://www.w3schools.com/jsref/jsref_touppercase.asp
Someone else should comment if they have more inside information.