List of utility methods to do String Title Case
String | titleCase(final String input) title Case if (input.contains(" ")) { final String[] strings = input.split(" "); final StringBuilder sb = new StringBuilder(); for (final String s : strings) { sb.append(s.substring(0, 1).toUpperCase()).append(s.substring(1).toLowerCase()).append(" "); return sb.toString(); return input.substring(0, 1).toUpperCase() + input.substring(1).toLowerCase(); |
String | titleCase(final String s) title Case if (s == null || s.length() == 0) { return s; } else if (s.length() == 1) { return s.toUpperCase(); } else { StringBuilder result = new StringBuilder(s.length()); String delim = ""; for (String eachPart : s.split(" ")) { ... |
String | titleCase(final String text) title Case if (text == null) { throw new IllegalArgumentException("text"); return text.substring(0, 1).toUpperCase().concat(text.substring(1)); |
String | titleCase(String in) title Case StringBuilder sb = new StringBuilder(in); boolean cap = true; for (int i = 0; i < sb.length(); i++) { char ch = sb.charAt(i); if (ch == '_') { sb.setCharAt(i, ' '); cap = true; continue; ... |
String | titleCase(String input) title Case return input.substring(0, 1).toUpperCase() + input.substring(1);
|
String | titleCase(String name) Return the string in Titlecase, i.e. if (name.length() == 0) return name; return Character.toUpperCase(name.charAt(0)) + name.substring(1); |
String | titleCase(String raw) Returns a TitleCase version of the String supplied String s = raw; if (s != null) { if (s.length() > 1) { s = s.substring(0, 1).toUpperCase() + s.substring(1); } else if (s.length() == 1) { s = s.toUpperCase(); return s; |
String | titleCase(String realName) title Case String space = " "; String[] names = realName.split(space); StringBuilder b = new StringBuilder(); for (String name : names) { if (name == null || name.isEmpty()) { b.append(space); continue; b.append(name.substring(0, 1).toUpperCase()).append(name.substring(1).toLowerCase()).append(space); return b.toString(); |
String | titleCase(String s) Returns a title case version of the String. if (s.length() > 1) { return s.substring(0, 1).toUpperCase() + s.substring(1); return s.toUpperCase(); |
String | titleCase(String str) title Case StringBuilder ret = new StringBuilder(); boolean st = true; for (char c : str.toLowerCase().toCharArray()) { if (st) { ret.append(Character.toTitleCase(c)); } else { ret.append(c); st = c == ' '; return ret.toString(); |