mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-10 12:05:06 +00:00
Renamed methods so that they follow the "MethodNameEvenForAcronyms"-scheme.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137814 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
687abc5024
commit
0ca766679c
@ -24,7 +24,7 @@
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
* @since 2.1
|
||||
* @version $Id: CharUtils.java,v 1.4 2004/02/19 21:04:03 fredrik Exp $
|
||||
* @version $Id: CharUtils.java,v 1.5 2004/02/24 22:22:51 fredrik Exp $
|
||||
*/
|
||||
public class CharUtils {
|
||||
|
||||
@ -192,7 +192,7 @@ public static char toCharacter(String str, char defaultValue) {
|
||||
* @throws IllegalArgumentException if the character is not ASCII numeric
|
||||
*/
|
||||
public static int toInteger(char ch) {
|
||||
if (isASCIINumeric(ch) == false) {
|
||||
if (isAsciiNumeric(ch) == false) {
|
||||
throw new IllegalArgumentException("The character " + ch + " is not in the range '0' - '9'");
|
||||
}
|
||||
return (ch - 48);
|
||||
@ -214,7 +214,7 @@ public static int toInteger(char ch) {
|
||||
* @return the int value of the character
|
||||
*/
|
||||
public static int toInteger(char ch, int defaultValue) {
|
||||
if (isASCIINumeric(ch) == false) {
|
||||
if (isAsciiNumeric(ch) == false) {
|
||||
return defaultValue;
|
||||
}
|
||||
return (ch - 48);
|
||||
@ -367,18 +367,18 @@ public static String unicodeEscaped(Character ch) {
|
||||
* <p>Checks whether the character is ASCII 7 bit.</p>
|
||||
*
|
||||
* <pre>
|
||||
* CharUtils.isASCII('a') = true
|
||||
* CharUtils.isASCII('A') = true
|
||||
* CharUtils.isASCII('3') = true
|
||||
* CharUtils.isASCII('-') = true
|
||||
* CharUtils.isASCII('\n') = true
|
||||
* CharUtils.isASCII('©') = false
|
||||
* CharUtils.isAscii('a') = true
|
||||
* CharUtils.isAscii('A') = true
|
||||
* CharUtils.isAscii('3') = true
|
||||
* CharUtils.isAscii('-') = true
|
||||
* CharUtils.isAscii('\n') = true
|
||||
* CharUtils.isAscii('©') = false
|
||||
* </pre>
|
||||
*
|
||||
* @param ch the character to check
|
||||
* @return true if less than 128
|
||||
*/
|
||||
public static boolean isASCII(char ch) {
|
||||
public static boolean isAscii(char ch) {
|
||||
return (ch < 128);
|
||||
}
|
||||
|
||||
@ -386,18 +386,18 @@ public static boolean isASCII(char ch) {
|
||||
* <p>Checks whether the character is ASCII 7 bit printable.</p>
|
||||
*
|
||||
* <pre>
|
||||
* CharUtils.isASCIIPrintable('a') = true
|
||||
* CharUtils.isASCIIPrintable('A') = true
|
||||
* CharUtils.isASCIIPrintable('3') = true
|
||||
* CharUtils.isASCIIPrintable('-') = true
|
||||
* CharUtils.isASCIIPrintable('\n') = false
|
||||
* CharUtils.isASCIIPrintable('©') = false
|
||||
* CharUtils.isAsciiPrintable('a') = true
|
||||
* CharUtils.isAsciiPrintable('A') = true
|
||||
* CharUtils.isAsciiPrintable('3') = true
|
||||
* CharUtils.isAsciiPrintable('-') = true
|
||||
* CharUtils.isAsciiPrintable('\n') = false
|
||||
* CharUtils.isAsciiPrintable('©') = false
|
||||
* </pre>
|
||||
*
|
||||
* @param ch the character to check
|
||||
* @return true if between 32 and 126 inclusive
|
||||
*/
|
||||
public static boolean isASCIIPrintable(char ch) {
|
||||
public static boolean isAsciiPrintable(char ch) {
|
||||
return (ch >= 32 && ch < 127);
|
||||
}
|
||||
|
||||
@ -405,18 +405,18 @@ public static boolean isASCIIPrintable(char ch) {
|
||||
* <p>Checks whether the character is ASCII 7 bit control.</p>
|
||||
*
|
||||
* <pre>
|
||||
* CharUtils.isASCIIControl('a') = false
|
||||
* CharUtils.isASCIIControl('A') = false
|
||||
* CharUtils.isASCIIControl('3') = false
|
||||
* CharUtils.isASCIIControl('-') = false
|
||||
* CharUtils.isASCIIControl('\n') = true
|
||||
* CharUtils.isASCIIControl('©') = false
|
||||
* CharUtils.isAsciiControl('a') = false
|
||||
* CharUtils.isAsciiControl('A') = false
|
||||
* CharUtils.isAsciiControl('3') = false
|
||||
* CharUtils.isAsciiControl('-') = false
|
||||
* CharUtils.isAsciiControl('\n') = true
|
||||
* CharUtils.isAsciiControl('©') = false
|
||||
* </pre>
|
||||
*
|
||||
* @param ch the character to check
|
||||
* @return true if less than 32 or equals 127
|
||||
*/
|
||||
public static boolean isASCIIControl(char ch) {
|
||||
public static boolean isAsciiControl(char ch) {
|
||||
return (ch < 32 || ch == 127);
|
||||
}
|
||||
|
||||
@ -424,18 +424,18 @@ public static boolean isASCIIControl(char ch) {
|
||||
* <p>Checks whether the character is ASCII 7 bit alphabetic.</p>
|
||||
*
|
||||
* <pre>
|
||||
* CharUtils.isASCIIAlpha('a') = true
|
||||
* CharUtils.isASCIIAlpha('A') = true
|
||||
* CharUtils.isASCIIAlpha('3') = false
|
||||
* CharUtils.isASCIIAlpha('-') = false
|
||||
* CharUtils.isASCIIAlpha('\n') = false
|
||||
* CharUtils.isASCIIAlpha('©') = false
|
||||
* CharUtils.isAsciiAlpha('a') = true
|
||||
* CharUtils.isAsciiAlpha('A') = true
|
||||
* CharUtils.isAsciiAlpha('3') = false
|
||||
* CharUtils.isAsciiAlpha('-') = false
|
||||
* CharUtils.isAsciiAlpha('\n') = false
|
||||
* CharUtils.isAsciiAlpha('©') = false
|
||||
* </pre>
|
||||
*
|
||||
* @param ch the character to check
|
||||
* @return true if between 65 and 90 or 97 and 122 inclusive
|
||||
*/
|
||||
public static boolean isASCIIAlpha(char ch) {
|
||||
public static boolean isAsciiAlpha(char ch) {
|
||||
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
|
||||
}
|
||||
|
||||
@ -443,18 +443,18 @@ public static boolean isASCIIAlpha(char ch) {
|
||||
* <p>Checks whether the character is ASCII 7 bit alphabetic upper case.</p>
|
||||
*
|
||||
* <pre>
|
||||
* CharUtils.isASCIIAlphaUpper('a') = false
|
||||
* CharUtils.isASCIIAlphaUpper('A') = true
|
||||
* CharUtils.isASCIIAlphaUpper('3') = false
|
||||
* CharUtils.isASCIIAlphaUpper('-') = false
|
||||
* CharUtils.isASCIIAlphaUpper('\n') = false
|
||||
* CharUtils.isASCIIAlphaUpper('©') = false
|
||||
* CharUtils.isAsciiAlphaUpper('a') = false
|
||||
* CharUtils.isAsciiAlphaUpper('A') = true
|
||||
* CharUtils.isAsciiAlphaUpper('3') = false
|
||||
* CharUtils.isAsciiAlphaUpper('-') = false
|
||||
* CharUtils.isAsciiAlphaUpper('\n') = false
|
||||
* CharUtils.isAsciiAlphaUpper('©') = false
|
||||
* </pre>
|
||||
*
|
||||
* @param ch the character to check
|
||||
* @return true if between 65 and 90 inclusive
|
||||
*/
|
||||
public static boolean isASCIIAlphaUpper(char ch) {
|
||||
public static boolean isAsciiAlphaUpper(char ch) {
|
||||
return (ch >= 'A' && ch <= 'Z');
|
||||
}
|
||||
|
||||
@ -462,18 +462,18 @@ public static boolean isASCIIAlphaUpper(char ch) {
|
||||
* <p>Checks whether the character is ASCII 7 bit alphabetic lower case.</p>
|
||||
*
|
||||
* <pre>
|
||||
* CharUtils.isASCIIAlphaLower('a') = true
|
||||
* CharUtils.isASCIIAlphaLower('A') = false
|
||||
* CharUtils.isASCIIAlphaLower('3') = false
|
||||
* CharUtils.isASCIIAlphaLower('-') = false
|
||||
* CharUtils.isASCIIAlphaLower('\n') = false
|
||||
* CharUtils.isASCIIAlphaLower('©') = false
|
||||
* CharUtils.isAsciiAlphaLower('a') = true
|
||||
* CharUtils.isAsciiAlphaLower('A') = false
|
||||
* CharUtils.isAsciiAlphaLower('3') = false
|
||||
* CharUtils.isAsciiAlphaLower('-') = false
|
||||
* CharUtils.isAsciiAlphaLower('\n') = false
|
||||
* CharUtils.isAsciiAlphaLower('©') = false
|
||||
* </pre>
|
||||
*
|
||||
* @param ch the character to check
|
||||
* @return true if between 97 and 122 inclusive
|
||||
*/
|
||||
public static boolean isASCIIAlphaLower(char ch) {
|
||||
public static boolean isAsciiAlphaLower(char ch) {
|
||||
return (ch >= 'a' && ch <= 'z');
|
||||
}
|
||||
|
||||
@ -481,18 +481,18 @@ public static boolean isASCIIAlphaLower(char ch) {
|
||||
* <p>Checks whether the character is ASCII 7 bit numeric.</p>
|
||||
*
|
||||
* <pre>
|
||||
* CharUtils.isASCIINumeric('a') = false
|
||||
* CharUtils.isASCIINumeric('A') = false
|
||||
* CharUtils.isASCIINumeric('3') = true
|
||||
* CharUtils.isASCIINumeric('-') = false
|
||||
* CharUtils.isASCIINumeric('\n') = false
|
||||
* CharUtils.isASCIINumeric('©') = false
|
||||
* CharUtils.isAsciiNumeric('a') = false
|
||||
* CharUtils.isAsciiNumeric('A') = false
|
||||
* CharUtils.isAsciiNumeric('3') = true
|
||||
* CharUtils.isAsciiNumeric('-') = false
|
||||
* CharUtils.isAsciiNumeric('\n') = false
|
||||
* CharUtils.isAsciiNumeric('©') = false
|
||||
* </pre>
|
||||
*
|
||||
* @param ch the character to check
|
||||
* @return true if between 48 and 57 inclusive
|
||||
*/
|
||||
public static boolean isASCIINumeric(char ch) {
|
||||
public static boolean isAsciiNumeric(char ch) {
|
||||
return (ch >= '0' && ch <= '9');
|
||||
}
|
||||
|
||||
@ -500,18 +500,18 @@ public static boolean isASCIINumeric(char ch) {
|
||||
* <p>Checks whether the character is ASCII 7 bit numeric.</p>
|
||||
*
|
||||
* <pre>
|
||||
* CharUtils.isASCIIAlphanumeric('a') = true
|
||||
* CharUtils.isASCIIAlphanumeric('A') = true
|
||||
* CharUtils.isASCIIAlphanumeric('3') = true
|
||||
* CharUtils.isASCIIAlphanumeric('-') = false
|
||||
* CharUtils.isASCIIAlphanumeric('\n') = false
|
||||
* CharUtils.isASCIIAlphanumeric('©') = false
|
||||
* CharUtils.isAsciiAlphanumeric('a') = true
|
||||
* CharUtils.isAsciiAlphanumeric('A') = true
|
||||
* CharUtils.isAsciiAlphanumeric('3') = true
|
||||
* CharUtils.isAsciiAlphanumeric('-') = false
|
||||
* CharUtils.isAsciiAlphanumeric('\n') = false
|
||||
* CharUtils.isAsciiAlphanumeric('©') = false
|
||||
* </pre>
|
||||
*
|
||||
* @param ch the character to check
|
||||
* @return true if between 48 and 57 or 65 and 90 or 97 and 122 inclusive
|
||||
*/
|
||||
public static boolean isASCIIAlphanumeric(char ch) {
|
||||
public static boolean isAsciiAlphanumeric(char ch) {
|
||||
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9');
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
* Unit tests {@link org.apache.commons.lang.CharUtils}.
|
||||
*
|
||||
* @author Stephen Colebourne
|
||||
* @version $Id: CharUtilsTest.java,v 1.2 2004/02/18 23:06:19 ggregory Exp $
|
||||
* @version $Id: CharUtilsTest.java,v 1.3 2004/02/24 22:22:51 fredrik Exp $
|
||||
*/
|
||||
public class CharUtilsTest extends TestCase {
|
||||
|
||||
@ -212,145 +212,145 @@ public void testToUnicodeEscaped_Character() {
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testIsASCII_char() {
|
||||
assertEquals(true, CharUtils.isASCII('a'));
|
||||
assertEquals(true, CharUtils.isASCII('A'));
|
||||
assertEquals(true, CharUtils.isASCII('3'));
|
||||
assertEquals(true, CharUtils.isASCII('-'));
|
||||
assertEquals(true, CharUtils.isASCII('\n'));
|
||||
assertEquals(false, CharUtils.isASCII(CHAR_COPY));
|
||||
public void testIsAscii_char() {
|
||||
assertEquals(true, CharUtils.isAscii('a'));
|
||||
assertEquals(true, CharUtils.isAscii('A'));
|
||||
assertEquals(true, CharUtils.isAscii('3'));
|
||||
assertEquals(true, CharUtils.isAscii('-'));
|
||||
assertEquals(true, CharUtils.isAscii('\n'));
|
||||
assertEquals(false, CharUtils.isAscii(CHAR_COPY));
|
||||
|
||||
for (int i = 0; i < 128; i++) {
|
||||
if (i < 128) {
|
||||
assertEquals(true, CharUtils.isASCII((char) i));
|
||||
assertEquals(true, CharUtils.isAscii((char) i));
|
||||
} else {
|
||||
assertEquals(false, CharUtils.isASCII((char) i));
|
||||
assertEquals(false, CharUtils.isAscii((char) i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testIsASCIIPrintable_char() {
|
||||
assertEquals(true, CharUtils.isASCIIPrintable('a'));
|
||||
assertEquals(true, CharUtils.isASCIIPrintable('A'));
|
||||
assertEquals(true, CharUtils.isASCIIPrintable('3'));
|
||||
assertEquals(true, CharUtils.isASCIIPrintable('-'));
|
||||
assertEquals(false, CharUtils.isASCIIPrintable('\n'));
|
||||
assertEquals(false, CharUtils.isASCII(CHAR_COPY));
|
||||
public void testIsAsciiPrintable_char() {
|
||||
assertEquals(true, CharUtils.isAsciiPrintable('a'));
|
||||
assertEquals(true, CharUtils.isAsciiPrintable('A'));
|
||||
assertEquals(true, CharUtils.isAsciiPrintable('3'));
|
||||
assertEquals(true, CharUtils.isAsciiPrintable('-'));
|
||||
assertEquals(false, CharUtils.isAsciiPrintable('\n'));
|
||||
assertEquals(false, CharUtils.isAscii(CHAR_COPY));
|
||||
|
||||
for (int i = 0; i < 196; i++) {
|
||||
if (i >= 32 && i <= 126) {
|
||||
assertEquals(true, CharUtils.isASCIIPrintable((char) i));
|
||||
assertEquals(true, CharUtils.isAsciiPrintable((char) i));
|
||||
} else {
|
||||
assertEquals(false, CharUtils.isASCIIPrintable((char) i));
|
||||
assertEquals(false, CharUtils.isAsciiPrintable((char) i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testIsASCIIControl_char() {
|
||||
assertEquals(false, CharUtils.isASCIIControl('a'));
|
||||
assertEquals(false, CharUtils.isASCIIControl('A'));
|
||||
assertEquals(false, CharUtils.isASCIIControl('3'));
|
||||
assertEquals(false, CharUtils.isASCIIControl('-'));
|
||||
assertEquals(true, CharUtils.isASCIIControl('\n'));
|
||||
assertEquals(false, CharUtils.isASCIIControl(CHAR_COPY));
|
||||
public void testIsAsciiControl_char() {
|
||||
assertEquals(false, CharUtils.isAsciiControl('a'));
|
||||
assertEquals(false, CharUtils.isAsciiControl('A'));
|
||||
assertEquals(false, CharUtils.isAsciiControl('3'));
|
||||
assertEquals(false, CharUtils.isAsciiControl('-'));
|
||||
assertEquals(true, CharUtils.isAsciiControl('\n'));
|
||||
assertEquals(false, CharUtils.isAsciiControl(CHAR_COPY));
|
||||
|
||||
for (int i = 0; i < 196; i++) {
|
||||
if (i < 32 || i == 127) {
|
||||
assertEquals(true, CharUtils.isASCIIControl((char) i));
|
||||
assertEquals(true, CharUtils.isAsciiControl((char) i));
|
||||
} else {
|
||||
assertEquals(false, CharUtils.isASCIIControl((char) i));
|
||||
assertEquals(false, CharUtils.isAsciiControl((char) i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testIsASCIIAlpha_char() {
|
||||
assertEquals(true, CharUtils.isASCIIAlpha('a'));
|
||||
assertEquals(true, CharUtils.isASCIIAlpha('A'));
|
||||
assertEquals(false, CharUtils.isASCIIAlpha('3'));
|
||||
assertEquals(false, CharUtils.isASCIIAlpha('-'));
|
||||
assertEquals(false, CharUtils.isASCIIAlpha('\n'));
|
||||
assertEquals(false, CharUtils.isASCIIAlpha(CHAR_COPY));
|
||||
public void testIsAsciiAlpha_char() {
|
||||
assertEquals(true, CharUtils.isAsciiAlpha('a'));
|
||||
assertEquals(true, CharUtils.isAsciiAlpha('A'));
|
||||
assertEquals(false, CharUtils.isAsciiAlpha('3'));
|
||||
assertEquals(false, CharUtils.isAsciiAlpha('-'));
|
||||
assertEquals(false, CharUtils.isAsciiAlpha('\n'));
|
||||
assertEquals(false, CharUtils.isAsciiAlpha(CHAR_COPY));
|
||||
|
||||
for (int i = 0; i < 196; i++) {
|
||||
if ((i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z')) {
|
||||
assertEquals(true, CharUtils.isASCIIAlpha((char) i));
|
||||
assertEquals(true, CharUtils.isAsciiAlpha((char) i));
|
||||
} else {
|
||||
assertEquals(false, CharUtils.isASCIIAlpha((char) i));
|
||||
assertEquals(false, CharUtils.isAsciiAlpha((char) i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testIsASCIIAlphaUpper_char() {
|
||||
assertEquals(false, CharUtils.isASCIIAlphaUpper('a'));
|
||||
assertEquals(true, CharUtils.isASCIIAlphaUpper('A'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphaUpper('3'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphaUpper('-'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphaUpper('\n'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphaUpper(CHAR_COPY));
|
||||
public void testIsAsciiAlphaUpper_char() {
|
||||
assertEquals(false, CharUtils.isAsciiAlphaUpper('a'));
|
||||
assertEquals(true, CharUtils.isAsciiAlphaUpper('A'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaUpper('3'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaUpper('-'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaUpper('\n'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaUpper(CHAR_COPY));
|
||||
|
||||
for (int i = 0; i < 196; i++) {
|
||||
if (i >= 'A' && i <= 'Z') {
|
||||
assertEquals(true, CharUtils.isASCIIAlphaUpper((char) i));
|
||||
assertEquals(true, CharUtils.isAsciiAlphaUpper((char) i));
|
||||
} else {
|
||||
assertEquals(false, CharUtils.isASCIIAlphaUpper((char) i));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaUpper((char) i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testIsASCIIAlphaLower_char() {
|
||||
assertEquals(true, CharUtils.isASCIIAlphaLower('a'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphaLower('A'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphaLower('3'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphaLower('-'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphaLower('\n'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphaLower(CHAR_COPY));
|
||||
public void testIsAsciiAlphaLower_char() {
|
||||
assertEquals(true, CharUtils.isAsciiAlphaLower('a'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaLower('A'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaLower('3'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaLower('-'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaLower('\n'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaLower(CHAR_COPY));
|
||||
|
||||
for (int i = 0; i < 196; i++) {
|
||||
if (i >= 'a' && i <= 'z') {
|
||||
assertEquals(true, CharUtils.isASCIIAlphaLower((char) i));
|
||||
assertEquals(true, CharUtils.isAsciiAlphaLower((char) i));
|
||||
} else {
|
||||
assertEquals(false, CharUtils.isASCIIAlphaLower((char) i));
|
||||
assertEquals(false, CharUtils.isAsciiAlphaLower((char) i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testIsASCIINumeric_char() {
|
||||
assertEquals(false, CharUtils.isASCIINumeric('a'));
|
||||
assertEquals(false, CharUtils.isASCIINumeric('A'));
|
||||
assertEquals(true, CharUtils.isASCIINumeric('3'));
|
||||
assertEquals(false, CharUtils.isASCIINumeric('-'));
|
||||
assertEquals(false, CharUtils.isASCIINumeric('\n'));
|
||||
assertEquals(false, CharUtils.isASCIINumeric(CHAR_COPY));
|
||||
public void testIsAsciiNumeric_char() {
|
||||
assertEquals(false, CharUtils.isAsciiNumeric('a'));
|
||||
assertEquals(false, CharUtils.isAsciiNumeric('A'));
|
||||
assertEquals(true, CharUtils.isAsciiNumeric('3'));
|
||||
assertEquals(false, CharUtils.isAsciiNumeric('-'));
|
||||
assertEquals(false, CharUtils.isAsciiNumeric('\n'));
|
||||
assertEquals(false, CharUtils.isAsciiNumeric(CHAR_COPY));
|
||||
|
||||
for (int i = 0; i < 196; i++) {
|
||||
if (i >= '0' && i <= '9') {
|
||||
assertEquals(true, CharUtils.isASCIINumeric((char) i));
|
||||
assertEquals(true, CharUtils.isAsciiNumeric((char) i));
|
||||
} else {
|
||||
assertEquals(false, CharUtils.isASCIINumeric((char) i));
|
||||
assertEquals(false, CharUtils.isAsciiNumeric((char) i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
public void testIsASCIIAlphanumeric_char() {
|
||||
assertEquals(true, CharUtils.isASCIIAlphanumeric('a'));
|
||||
assertEquals(true, CharUtils.isASCIIAlphanumeric('A'));
|
||||
assertEquals(true, CharUtils.isASCIIAlphanumeric('3'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphanumeric('-'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphanumeric('\n'));
|
||||
assertEquals(false, CharUtils.isASCIIAlphanumeric(CHAR_COPY));
|
||||
public void testIsAsciiAlphanumeric_char() {
|
||||
assertEquals(true, CharUtils.isAsciiAlphanumeric('a'));
|
||||
assertEquals(true, CharUtils.isAsciiAlphanumeric('A'));
|
||||
assertEquals(true, CharUtils.isAsciiAlphanumeric('3'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphanumeric('-'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphanumeric('\n'));
|
||||
assertEquals(false, CharUtils.isAsciiAlphanumeric(CHAR_COPY));
|
||||
|
||||
for (int i = 0; i < 196; i++) {
|
||||
if ((i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z') || (i >= '0' && i <= '9')) {
|
||||
assertEquals(true, CharUtils.isASCIIAlphanumeric((char) i));
|
||||
assertEquals(true, CharUtils.isAsciiAlphanumeric((char) i));
|
||||
} else {
|
||||
assertEquals(false, CharUtils.isASCIIAlphanumeric((char) i));
|
||||
assertEquals(false, CharUtils.isAsciiAlphanumeric((char) i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user