Is there a method in Java that capitalizes every first letter of a string?
jon skeet -> Jon Skeet Miles o'Brien -> Miles O'Brien (exclude the title and keep the original capital letter) old mcdonald -> Old Mcdonald*
*(Old McDonald is better, but you don't have to do that...))
In the Java document I've seen, there are to UpperCase() and toLowerCase(), which are all uppercase and lowercase characters, so it's not what I want. Is there any method to change it like the example above?
string java capitalize
If you look at the apach public library, there is a method called WordUtils.capitalize(str). This is a method of capitalizing the first letter of a word.
If you want to change the string "fOO BAR" to "Foo Bar", you can use capitalizeFully().
© 2024 OneMinuteCode. All rights reserved.