@Test public void uncapitalizeTest() { assertThat(LangUtils.uncapitalize(null), is(nullValue())); assertThat(LangUtils.uncapitalize(""), is("")); assertThat(LangUtils.uncapitalize("cat"), is("cat")); assertThat(LangUtils.uncapitalize("Cat"), is("cat")); assertThat(LangUtils.uncapitalize("CAT"), is("cAT")); }
public static String uncapitalize(String s) { if (Strings.isNullOrEmpty(s)) return s; int ch = s.codePointAt(0); if ((Character.getType(ch) & Character.UPPERCASE_LETTER) == 0) return s; ch = Character.toLowerCase(ch); if (Character.isBmpCodePoint(ch)) return ((char) ch) + s.substring(1); else return Character.highSurrogate(ch) + Character.lowSurrogate(ch) + s.substring(2); }
LangUtils { public static String uncapitalize(String s) { if (Strings.isNullOrEmpty(s)) return s; int ch = s.codePointAt(0); if ((Character.getType(ch) & Character.UPPERCASE_LETTER) == 0) return s; ch = Character.toLowerCase(ch); if (Character.isBmpCodePoint(ch)) return ((char) ch) + s.substring(1); else return Character.highSurrogate(ch) + Character.lowSurrogate(ch) + s.substring(2); } }
LangUtils { public static String uncapitalize(String s) { if (Strings.isNullOrEmpty(s)) return s; int ch = s.codePointAt(0); if ((Character.getType(ch) & Character.UPPERCASE_LETTER) == 0) return s; ch = Character.toLowerCase(ch); if (Character.isBmpCodePoint(ch)) return ((char) ch) + s.substring(1); else return Character.highSurrogate(ch) + Character.lowSurrogate(ch) + s.substring(2); } private  LangUtils(); }
LangUtils { public static String uncapitalize(String s) { if (Strings.isNullOrEmpty(s)) return s; int ch = s.codePointAt(0); if ((Character.getType(ch) & Character.UPPERCASE_LETTER) == 0) return s; ch = Character.toLowerCase(ch); if (Character.isBmpCodePoint(ch)) return ((char) ch) + s.substring(1); else return Character.highSurrogate(ch) + Character.lowSurrogate(ch) + s.substring(2); } private  LangUtils(); static boolean isBlank(String s); static boolean containsIgnoreCase(String s, String ss); static String capitalize(String s); static String uncapitalize(String s); static String join(CharSequence delimiter, Stream<?> stream); static String join(CharSequence delimiter, Iterator<?> iterator); static String join(CharSequence delimiter, Iterable<?> iterable); }
LangUtils { public static String uncapitalize(String s) { if (Strings.isNullOrEmpty(s)) return s; int ch = s.codePointAt(0); if ((Character.getType(ch) & Character.UPPERCASE_LETTER) == 0) return s; ch = Character.toLowerCase(ch); if (Character.isBmpCodePoint(ch)) return ((char) ch) + s.substring(1); else return Character.highSurrogate(ch) + Character.lowSurrogate(ch) + s.substring(2); } private  LangUtils(); static boolean isBlank(String s); static boolean containsIgnoreCase(String s, String ss); static String capitalize(String s); static String uncapitalize(String s); static String join(CharSequence delimiter, Stream<?> stream); static String join(CharSequence delimiter, Iterator<?> iterator); static String join(CharSequence delimiter, Iterable<?> iterable); static final String[] EMPTY_STRING_ARRAY; }