@Test public void testFistToUpperCase() { assertEquals("XZYyy", StringUtil.first2UpperCase("xZYyy")); assertEquals("XZYyy", StringUtil.first2UpperCase("XZYyy")); assertEquals("", StringUtil.first2UpperCase("")); }
public static String first2UpperCase(final String strValue) { Assertion.check().isNotNull(strValue); if (strValue.isEmpty()) { return strValue; } final char firstChar = strValue.charAt(0); if (Character.isLowerCase(firstChar)) { return Character.toUpperCase(firstChar) + strValue.substring(1); } return strValue; }
StringUtil { public static String first2UpperCase(final String strValue) { Assertion.check().isNotNull(strValue); if (strValue.isEmpty()) { return strValue; } final char firstChar = strValue.charAt(0); if (Character.isLowerCase(firstChar)) { return Character.toUpperCase(firstChar) + strValue.substring(1); } return strValue; } }
StringUtil { public static String first2UpperCase(final String strValue) { Assertion.check().isNotNull(strValue); if (strValue.isEmpty()) { return strValue; } final char firstChar = strValue.charAt(0); if (Character.isLowerCase(firstChar)) { return Character.toUpperCase(firstChar) + strValue.substring(1); } return strValue; } private  StringUtil(); }
StringUtil { public static String first2UpperCase(final String strValue) { Assertion.check().isNotNull(strValue); if (strValue.isEmpty()) { return strValue; } final char firstChar = strValue.charAt(0); if (Character.isLowerCase(firstChar)) { return Character.toUpperCase(firstChar) + strValue.substring(1); } return strValue; } private  StringUtil(); static boolean isBlank(final String strValue); static String first2LowerCase(final String strValue); static String first2UpperCase(final String strValue); static String constToLowerCamelCase(final String str); static String constToUpperCamelCase(final String str); static String camelToConstCase(final String str); static String camelToSnakeCase(final String str); static boolean isUpperCamelCase(final String testString); static boolean isLowerCamelCase(final String testString); static boolean isSimpleLetterOrDigit(final char c); static String replace(final String str, final String oldStr, final String newStr); static void replace(final StringBuilder str, final String oldStr, final String newStr); static String format(final String msg, final Object... params); }
StringUtil { public static String first2UpperCase(final String strValue) { Assertion.check().isNotNull(strValue); if (strValue.isEmpty()) { return strValue; } final char firstChar = strValue.charAt(0); if (Character.isLowerCase(firstChar)) { return Character.toUpperCase(firstChar) + strValue.substring(1); } return strValue; } private  StringUtil(); static boolean isBlank(final String strValue); static String first2LowerCase(final String strValue); static String first2UpperCase(final String strValue); static String constToLowerCamelCase(final String str); static String constToUpperCamelCase(final String str); static String camelToConstCase(final String str); static String camelToSnakeCase(final String str); static boolean isUpperCamelCase(final String testString); static boolean isLowerCamelCase(final String testString); static boolean isSimpleLetterOrDigit(final char c); static String replace(final String str, final String oldStr, final String newStr); static void replace(final StringBuilder str, final String oldStr, final String newStr); static String format(final String msg, final Object... params);  }