@Test(dataProvider = "capitalize") public void testCapitalize(String input, String expected) { assert expected.equals(StringUtils.capitalize(input)); }
public static String capitalize(String s) { if(isNullOrEmpty(s)) return EMPTY; StringBuilder out; out = new StringBuilder(s.length()); out.append(Character.toUpperCase(s.charAt(0))); if(s.length() > 1) out.append(s.substring(1).toLowerCase()); return out.toString(); }
StringUtils { public static String capitalize(String s) { if(isNullOrEmpty(s)) return EMPTY; StringBuilder out; out = new StringBuilder(s.length()); out.append(Character.toUpperCase(s.charAt(0))); if(s.length() > 1) out.append(s.substring(1).toLowerCase()); return out.toString(); } }
StringUtils { public static String capitalize(String s) { if(isNullOrEmpty(s)) return EMPTY; StringBuilder out; out = new StringBuilder(s.length()); out.append(Character.toUpperCase(s.charAt(0))); if(s.length() > 1) out.append(s.substring(1).toLowerCase()); return out.toString(); } private  StringUtils(); }
StringUtils { public static String capitalize(String s) { if(isNullOrEmpty(s)) return EMPTY; StringBuilder out; out = new StringBuilder(s.length()); out.append(Character.toUpperCase(s.charAt(0))); if(s.length() > 1) out.append(s.substring(1).toLowerCase()); return out.toString(); } private  StringUtils(); static boolean endsWithIgnoreCase(String a, String b); static boolean matchesIgnoreCase(String a, String b, int posA); static boolean endsWithIgnoreCase(String a, char[] b); static boolean matchesIgnoreCase(String a, char[] b, int posA); static boolean endsWith(String a, char[] b); static boolean matches(String a, char[] b, int posA); static boolean startsWithIgnoreCase(String a, String b); static boolean equals(String s1, String s2, Locale locale); static boolean equals(String s1, String s2, boolean caseSensitive); static int parseIntDef(String s, int def); static String capitalize(String s); static String flatten(String s[]); static String flatten(String s[], String separator); static boolean isNullOrEmpty(String string); }
StringUtils { public static String capitalize(String s) { if(isNullOrEmpty(s)) return EMPTY; StringBuilder out; out = new StringBuilder(s.length()); out.append(Character.toUpperCase(s.charAt(0))); if(s.length() > 1) out.append(s.substring(1).toLowerCase()); return out.toString(); } private  StringUtils(); static boolean endsWithIgnoreCase(String a, String b); static boolean matchesIgnoreCase(String a, String b, int posA); static boolean endsWithIgnoreCase(String a, char[] b); static boolean matchesIgnoreCase(String a, char[] b, int posA); static boolean endsWith(String a, char[] b); static boolean matches(String a, char[] b, int posA); static boolean startsWithIgnoreCase(String a, String b); static boolean equals(String s1, String s2, Locale locale); static boolean equals(String s1, String s2, boolean caseSensitive); static int parseIntDef(String s, int def); static String capitalize(String s); static String flatten(String s[]); static String flatten(String s[], String separator); static boolean isNullOrEmpty(String string); static final String EMPTY; }