Java tutorial
//package com.java2s; public class Main { public static String toTitleCase(String givenString) { if (givenString.length() > 0) { String[] arr = givenString.split(" "); StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; i++) { sb.append(Character.toUpperCase(arr[i].charAt(0))).append(arr[i].substring(1)).append(" "); } return sb.toString().trim(); } return ""; } }