public class Demo {
public static void main(String[] args) {
String str = "goOd gooD stUdy dAy dAy up";
str = str.toLowerCase();
String[] arr = str.split(" ");
for(int i = 0; i < arr.length; i++) {
arr[i] = arr[i].substring(0,1).toUpperCase().concat(arr[i].substring(1,arr[i].length())).concat(" ");
}
for(int i = 0; i < arr.length; i++) {
System.out.print(arr[i]);
}
}
} |
|