java capitilize first letter code example
Example 1: how to uppercase the first letter of a string in java
String str = "java";
String cap = str.substring(0, 1).toUpperCase() + str.substring(1);
Example 2: java first letter to upper case
StringUtils.capitalize(..)
Example 3: java capitalize first letter of each word
import org.apache.commons.text.WordUtils;
public class WordUtilsCapitalizeFullyExample {
public static void main(String[] args) {
String result1 = WordUtils.capitalizeFully("how to CAPITALIZE first letter words");
System.out.println(result1);
}
}