/** * Lowers uppercase ASCII char. */ public static char toLowerAscii(char c) { if (isUppercaseAlpha(c)) { c += (char) 0x20; } return c; }
/** * Lowers uppercase ASCII char. */ public static char toLowerAscii(char c) { if (isUppercaseAlpha(c)) { c += (char) 0x20; } return c; }
/** * Removes last CamelWord */ public static String stripLastCamelWord(String name) { int ndx = name.length() - 1; while (ndx >= 0) { if (CharUtil.isUppercaseAlpha(name.charAt(ndx))) { break; } ndx--; } if (ndx >= 0) { name = name.substring(0, ndx); } return name; }
/** * Resolves HTTP method name from method name. * If method name or first camel-case word of a method equals to * a HTTP method, it will be used as that HTTP methods. */ protected String resolveHttpMethodFromMethodName(final String methodName) { int i = 0; while (i < methodName.length()) { if (CharUtil.isUppercaseAlpha(methodName.charAt(i))) { break; } i++; } final String name = methodName.substring(0, i).toUpperCase(); for (final HttpMethod httpMethod : HttpMethod.values()) { if (httpMethod.equalsName(name)) { return httpMethod.name(); } } return null; }
@ParameterizedTest (name = "{index} : CharUtil.isUppercaseAlpha({1}) == {0}") @MethodSource({"testdata_testIsUppercaseAlpha"}) void testIsUppercaseAlpha(final boolean expected, final char input) { final boolean actual = CharUtil.isUppercaseAlpha(input); if (expected) { assertTrue(actual, "char '" + input + "' is no uppercase alpha but was expected."); } else { assertFalse(actual, "char '" + input + "' is uppercase alpha but was not expected."); } }
/** * Lowers uppercase ASCII char. */ public static char toLowerAscii(char c) { if (isUppercaseAlpha(c)) { c += (char) 0x20; } return c; }
/** * Lowers uppercase ASCII char. */ public static char toLowerAscii(char c) { if (isUppercaseAlpha(c)) { c += (char) 0x20; } return c; }