@Override String normalizeWord(String word) { return Ascii.toLowerCase(word); }
private boolean hasLowerCase() { for (char c : chars) { if (Ascii.isLowerCase(c)) { return true; } } return false; }
/** * If the argument is an {@linkplain #isUpperCase(char) uppercase ASCII character} returns the * lowercase equivalent. Otherwise returns the argument. */ public static char toLowerCase(char c) { return isUpperCase(c) ? (char) (c ^ 0x20) : c; }
private static String firstCharOnlyToUpper(String word) { return (word.isEmpty()) ? word : new StringBuilder(word.length()) .append(Ascii.toUpperCase(word.charAt(0))) .append(Ascii.toLowerCase(word.substring(1))) .toString(); } }
@Override String normalizeWord(String word) { return Ascii.toUpperCase(word); }
@Override public String toString() { return "CharSource.wrap(" + Ascii.truncate(seq, 30, "...") + ")"; } }
continue; int alphaIndex = getAlphaIndex(c1); if (alphaIndex < 26 && alphaIndex == getAlphaIndex(c2)) { continue;
/** * Returns a copy of the input character sequence in which all {@linkplain #isLowerCase(char) * lowercase ASCII characters} have been converted to uppercase. All other characters are copied * without modification. * * @since 14.0 */ public static String toUpperCase(CharSequence chars) { if (chars instanceof String) { return toUpperCase((String) chars); } int length = chars.length(); StringBuilder builder = new StringBuilder(length); for (int i = 0; i < length; i++) { builder.append(toUpperCase(chars.charAt(i))); } return builder.toString(); }
@Override public String toString() { return "ByteSource.wrap(" + Ascii.truncate(BaseEncoding.base16().encode(bytes, offset, length), 30, "...") + ")"; } }
@Override String normalizeWord(String word) { return Ascii.toLowerCase(word); }
@Override String convert(CaseFormat format, String s) { if (format == LOWER_UNDERSCORE) { return s.replace('-', '_'); } if (format == UPPER_UNDERSCORE) { return Ascii.toUpperCase(s.replace('-', '_')); } return super.convert(format, s); } },
private boolean hasUpperCase() { for (char c : chars) { if (Ascii.isUpperCase(c)) { return true; } } return false; }
/** * If the argument is a {@linkplain #isLowerCase(char) lowercase ASCII character} returns the * uppercase equivalent. Otherwise returns the argument. */ public static char toUpperCase(char c) { return isLowerCase(c) ? (char) (c & 0x5f) : c; }
@Override String convert(CaseFormat format, String s) { if (format == LOWER_HYPHEN) { return Ascii.toLowerCase(s.replace('_', '-')); } if (format == LOWER_UNDERSCORE) { return Ascii.toLowerCase(s); } return super.convert(format, s); } };
@Override String convert(CaseFormat format, String s) { if (format == LOWER_HYPHEN) { return s.replace('_', '-'); } if (format == UPPER_UNDERSCORE) { return Ascii.toUpperCase(s); } return super.convert(format, s); } },
/** * Returns a copy of the input string in which all {@linkplain #isUpperCase(char) uppercase ASCII * characters} have been converted to lowercase. All other characters are copied without * modification. */ public static String toLowerCase(String string) { int length = string.length(); for (int i = 0; i < length; i++) { if (isUpperCase(string.charAt(i))) { char[] chars = string.toCharArray(); for (; i < length; i++) { char c = chars[i]; if (isUpperCase(c)) { chars[i] = (char) (c ^ 0x20); } } return String.valueOf(chars); } } return string; }
/** * Returns a copy of the input string in which all {@linkplain #isLowerCase(char) lowercase ASCII * characters} have been converted to uppercase. All other characters are copied without * modification. */ public static String toUpperCase(String string) { int length = string.length(); for (int i = 0; i < length; i++) { if (isLowerCase(string.charAt(i))) { char[] chars = string.toCharArray(); for (; i < length; i++) { char c = chars[i]; if (isLowerCase(c)) { chars[i] = (char) (c & 0x5f); } } return String.valueOf(chars); } } return string; }
/** * Returns a copy of the input character sequence in which all {@linkplain #isUpperCase(char) * uppercase ASCII characters} have been converted to lowercase. All other characters are copied * without modification. * * @since 14.0 */ public static String toLowerCase(CharSequence chars) { if (chars instanceof String) { return toLowerCase((String) chars); } int length = chars.length(); StringBuilder builder = new StringBuilder(length); for (int i = 0; i < length; i++) { builder.append(toLowerCase(chars.charAt(i))); } return builder.toString(); }
Alphabet upperCase() { if (!hasLowerCase()) { return this; } else { checkState(!hasUpperCase(), "Cannot call upperCase() on a mixed-case alphabet"); char[] upperCased = new char[chars.length]; for (int i = 0; i < chars.length; i++) { upperCased[i] = Ascii.toUpperCase(chars[i]); } return new Alphabet(name + ".upperCase()", upperCased); } }
private String normalizeFirstWord(String word) { return (this == LOWER_CAMEL) ? Ascii.toLowerCase(word) : normalizeWord(word); }