List of utility methods to do String Capitalize Word
String | capitalizeInitials(String words) capitalize Initials String[] broken = words.split(" "); StringBuilder result = new StringBuilder(); for (String word : broken) { if (result.length() > 0) { result.append(" "); result.append(Character.toUpperCase(word.charAt(0))).append(word.substring(1)); return result.toString(); |
String | capitalizeOneWord(String inputWord) Capitalize one word. String firstLetter = inputWord.substring(0, 1);
String remainder = inputWord.substring(1);
return firstLetter.toUpperCase() + remainder.toLowerCase();
|
String | capitalizeSingle(String word) capitalize Single return word.substring(0, 1).toUpperCase() + word.substring(1);
|
String | capitalizeWord(String s) Capitalises the first letter of a given string. if ((s == null) || (s.length() == 0)) { return s; return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); |
String | capitalizeWord(String s) capitalize Word if (s.length() > 1) { return s.substring(0, 1).toUpperCase() + s.substring(1, s.length()).toLowerCase(); return s.toUpperCase(); |
String | capitalizeWord(String str) capitalize Word int strLen; if (str == null || (strLen = str.length()) == 0) { return str; return new StringBuilder(strLen).append(Character.toTitleCase(str.charAt(0))).append(str.substring(1)) .toString(); |
String | capitalizeWord(String word) capitalize Word return word.substring(0, 1).toUpperCase() + word.substring(1);
|
String | capitalizeWord(String word) Convert the initial of given string word to upper case.
String result = null; if ((word != null) && (word.trim().length() > 0)) { result = word.substring(0, 1).toUpperCase() + word.substring(1); } else { result = word; return result; |
String | capitalizeWord(String word) Capitalizes a word. For example: Util.capitalizeWord("bean");will return Bean. int len = word.length(); if (len == 1) return word.toUpperCase(); return word.substring(0, 1).toUpperCase() + word.substring(1); |
String | capitalizeWords(final String text) Capitalizes the first letter of every "word" in a string. if (text.isEmpty()) return text; final char[] chars = text.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); final int checkLenth = text.length() - 1; for (int i = 0; i < checkLenth;) { if (Character.isWhitespace(chars[i++])) chars[i] = Character.toUpperCase(chars[i]); ... |