@Override String normalizeWord(String word) { return Ascii.toLowerCase(word); }
@Override String normalizeWord(String word) { return Ascii.toLowerCase(word); }
private static String normalizeParameterValue(String attribute, String value) { return CHARSET_ATTRIBUTE.equals(attribute) ? Ascii.toLowerCase(value) : value; }
@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); } };
/** * 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); } char[] newChars = new char[chars.length()]; for (int i = 0; i < newChars.length; i++) { newChars[i] = toLowerCase(chars.charAt(i)); } return String.valueOf(newChars); }
private static String firstCharOnlyToUpper(String word) { return word.isEmpty() ? word : Ascii.toUpperCase(word.charAt(0)) + Ascii.toLowerCase(word.substring(1)); } }
@Override public String apply(String value) { return Ascii.toLowerCase(value); } };
@Override public String transformEntry(String key, String value) { return Ascii.toLowerCase(value); } };
private static String normalizeToken(String token) { checkArgument(TOKEN_MATCHER.matchesAllOf(token)); return Ascii.toLowerCase(token); }
private String normalizeFirstWord(String word) { return (this == LOWER_CAMEL) ? Ascii.toLowerCase(word) : normalizeWord(word); }
Alphabet lowerCase() { if (!hasUpperCase()) { return this; } else { checkState(!hasLowerCase(), "Cannot call lowerCase() on a mixed-case alphabet"); char[] lowerCased = new char[chars.length]; for (int i = 0; i < chars.length; i++) { lowerCased[i] = Ascii.toLowerCase(chars[i]); } return new Alphabet(name + ".lowerCase()", lowerCased); } }
public void testToLowerCase() { assertEquals(LOWER, Ascii.toLowerCase(UPPER)); assertSame(LOWER, Ascii.toLowerCase(LOWER)); assertEquals(IGNORED, Ascii.toLowerCase(IGNORED)); assertEquals("foobar", Ascii.toLowerCase("fOobaR")); }
private static String upperToHttpHeaderName( String constantName, ImmutableBiMap<String, String> specialCases, ImmutableSet<String> uppercaseAcronyms) { if (specialCases.containsKey(constantName)) { return specialCases.get(constantName); } List<String> parts = Lists.newArrayList(); for (String part : SPLITTER.split(constantName)) { if (!uppercaseAcronyms.contains(part)) { part = part.charAt(0) + Ascii.toLowerCase(part.substring(1)); } parts.add(part); } return JOINER.join(parts); } }
public void testToString() { for (String inputName : SOMEWHERE_UNDER_PS) { InternetDomainName domain = InternetDomainName.from(inputName); /* * We would ordinarily use constants for the expected results, but * doing it by derivation allows us to reuse the test case definitions * used in other tests. */ String expectedName = Ascii.toLowerCase(inputName); expectedName = expectedName.replaceAll("[\u3002\uFF0E\uFF61]", "."); if (expectedName.endsWith(".")) { expectedName = expectedName.substring(0, expectedName.length() - 1); } assertEquals(expectedName, domain.toString()); } }
public void testGetKeyMatchesString() { for (StandardSystemProperty property : StandardSystemProperty.values()) { String fieldName = property.name(); String expected = Ascii.toLowerCase(fieldName).replaceAll("_", "."); assertEquals(expected, property.key()); } }
public void testCharsLower() { for (char c : LOWER.toCharArray()) { String str = String.valueOf(c); assertTrue(str, c == Ascii.toLowerCase(c)); assertFalse(str, c == Ascii.toUpperCase(c)); assertTrue(str, Ascii.isLowerCase(c)); assertFalse(str, Ascii.isUpperCase(c)); } }
public void testCharsUpper() { for (char c : UPPER.toCharArray()) { String str = String.valueOf(c); assertFalse(str, c == Ascii.toLowerCase(c)); assertTrue(str, c == Ascii.toUpperCase(c)); assertFalse(str, Ascii.isLowerCase(c)); assertTrue(str, Ascii.isUpperCase(c)); } }
public void testCharsIgnored() { for (char c : IGNORED.toCharArray()) { String str = String.valueOf(c); assertTrue(str, c == Ascii.toLowerCase(c)); assertTrue(str, c == Ascii.toUpperCase(c)); assertFalse(str, Ascii.isLowerCase(c)); assertFalse(str, Ascii.isUpperCase(c)); } }
private static void testEncodingWithCasing( BaseEncoding encoding, String decoded, String encoded) { testEncodingWithSeparators(encoding, decoded, encoded); testEncodingWithSeparators(encoding.upperCase(), decoded, Ascii.toUpperCase(encoded)); testEncodingWithSeparators(encoding.lowerCase(), decoded, Ascii.toLowerCase(encoded)); }
@GwtIncompatible // Reader/Writer private static void testStreamingEncodingWithCasing( BaseEncoding encoding, String decoded, String encoded) throws IOException { testStreamingEncodingWithSeparators(encoding, decoded, encoded); testStreamingEncodingWithSeparators(encoding.upperCase(), decoded, Ascii.toUpperCase(encoded)); testStreamingEncodingWithSeparators(encoding.lowerCase(), decoded, Ascii.toLowerCase(encoded)); }