List of usage examples for java.lang Character toUpperCase
public static int toUpperCase(int codePoint)
From source file:Main.java
public static boolean checkIfClassHasMatchingGetMethod(Class<?> clazz, String columnname) { String neededMethodename = "get" + (Character.toUpperCase(columnname.charAt(0)) + columnname.substring(1)); for (Method aMethod : clazz.getMethods()) { if (neededMethodename.equals(aMethod.getName())) { return true; }// w w w.jav a 2 s .c o m } return false; }
From source file:Main.java
public static String toCamelCase(String tag) { String camel = ""; for (int j = 0; j < tag.length(); j++) { char ch = tag.charAt(j); if (j == 0) { camel += Character.toUpperCase(ch); } else if (ch == '-') { camel += Character.toUpperCase(tag.charAt(j + 1)); j++;//from w ww. ja va2 s .co m } else { camel += ch; } } return camel; }
From source file:Main.java
public static String capitalize(String s) { if (s == null || s.length() == 0) { return ""; }//from ww w.j a va 2 s. com char first = s.charAt(0); if (Character.isUpperCase(first)) { return s; } else { return Character.toUpperCase(first) + s.substring(1); } }
From source file:Main.java
private static String capitalize(String s) { if (s == null || s.length() == 0) { return ""; }/*from w ww . j a v a 2s .c o m*/ char first = s.charAt(0); if (Character.isUpperCase(first)) { return s; } else { return Character.toUpperCase(first) + s.substring(1); } }
From source file:Main.java
private static String capitalizeAllWords(String str) { String phrase = ""; boolean capitalize = true; for (char c : str.toLowerCase().toCharArray()) { if (Character.isLetter(c) && capitalize) { phrase += Character.toUpperCase(c); capitalize = false;//from w w w. ja v a2s . c om continue; } else if (c == ' ') { capitalize = true; } phrase += c; } return phrase; }
From source file:Main.java
public static String capitalizeFirstLetter(String paramString) { if (TextUtils.isEmpty(paramString)) return paramString; if (paramString.length() == 1) return paramString.toUpperCase(); return Character.toUpperCase(paramString.charAt(0)) + paramString.substring(1); }
From source file:Main.java
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(" "); }/*from w w w .j av a 2 s . com*/ return sb.toString().trim(); } return ""; }
From source file:Main.java
public static String first_letter_uppercase(String source) { StringBuffer res = new StringBuffer(); String[] strArr = source.split(" "); for (String str : strArr) { char[] stringArray = str.trim().toCharArray(); stringArray[0] = Character.toUpperCase(stringArray[0]); str = new String(stringArray); res.append(str).append(" "); }/*from w ww . j a v a 2s . co m*/ return String.valueOf(res); }
From source file:Main.java
public static String capitalizeFirstLetter(String str) { if (isEmpty(str)) { return str; }//w w w. ja va2s . c o m char c = str.charAt(0); return (!Character.isLetter(c) || Character.isUpperCase(c)) ? str : new StringBuilder(str.length()).append(Character.toUpperCase(c)).append(str.substring(1)) .toString(); }
From source file:Main.java
public static String upperFirstAndAddPre(String str, String preString) { if (str == null || preString == null) { return null; }//www .j ava 2 s . c o m return preString + Character.toUpperCase(str.charAt(0)) + str.substring(1); }