StringUtils { public static String capitalizeFirst(String str) { int first = indexOfAlphabetic(str); if (first < 0) { return str; } else if (first == 0) { return str.substring(0, 0 + 1).toUpperCase() + str.substring(0 + 1); } else { return str.substring(0, first) + str.substring(first, first + 1).toUpperCase() + str.substring(first + 1); } } private  StringUtils(); static boolean isNullOrEmpty(String str); static int indexOfAlphabetic(String str); static String capitalizeFirst(String str); static String deCapitalizeFirst(String str); static String join(Iterable<T> items, String delimiter); static String join(Iterable<T> items, Function<T, String> function, String delimiter); static String join(T[] items, String delimiter); static String join(T[] items, Function<T, String> function, String delimiter); static String getPrefix(Iterable<T> items, Function<T, String> function); static String getPrefix(Iterable<String> items); static final String loadResourceQuietly(String resourceName); static String loadResource(String resourceName); static final String loadResourceQuietly(URL resourceUrl); static String loadResource(URL resourceUrl); static final String compact(String name); static final String prefixKeywords(String name); static final String toFieldName(String name); static final String toPojoName(String name, String prefix, String suffix);  }
@Test public void testCapitalizeFirst() { assertEquals(null, capitalizeFirst(null)); assertEquals("", capitalizeFirst("")); assertEquals("123", capitalizeFirst("123")); assertEquals("Dog", capitalizeFirst("Dog")); assertEquals("Dog", capitalizeFirst("dog")); assertEquals("$Dog", capitalizeFirst("$dog")); assertEquals("_Dog", capitalizeFirst("_dog")); assertEquals("$_Dog", capitalizeFirst("$_dog")); assertEquals("1Dog", capitalizeFirst("1dog")); }