Modifier and Type | Method and Description |
---|---|
static int |
compareIgnoreCase(char first,
char second)
Compares two
char values lexicographically, ignoring case
differences. |
static int |
compareIgnoreCaseAscii(char first,
char second)
Compares two
char values, ignoring case differences in the ASCII
range. |
static boolean |
equalsIgnoreCase(char first,
char second)
Compares the characters, ignoring case considerations.
|
static boolean |
equalsIgnoreCaseAscii(char first,
char second)
Compares the characters, ignoring case considerations in the ASCII range.
|
static boolean |
isAsciiDigit(char character)
Determines if the specified character is an ASCII digit.
|
static boolean |
isAsciiLetter(char character)
Determines if the specified character is an ASCII letter.
|
static boolean |
isAsciiWhitespace(char character)
Determines if the specified character is an ASCII white space.
|
static char |
toLowerCaseAscii(char character)
Converts the character argument to lowercase when inside the ASCII range.
|
static char |
toUpperCaseAscii(char character)
Converts the character argument to uppercase when inside the ASCII range.
|
public static int compareIgnoreCase(char first, char second)
char
values lexicographically, ignoring case
differences. This method eliminates case differences by calling
Character.toLowerCase(Character.toUpperCase(character))
.
Note that this method does not take locale into account, and will result in an unsatisfactory ordering for certain locales.
first
- the first char
to comparesecond
- the second char
to comparefirst
char
is greater than, equal to, or less than second
char
, ignoring case considerations.public static int compareIgnoreCaseAscii(char first, char second)
char
values, ignoring case differences in the ASCII
range. This method eliminates case differences by calling
Characters.toLowerCaseAscii(character)
.
Note that this method does not ignore the case for characters outside of the ASCII range.
first
- the first char
to comparesecond
- the second char
to comparefirst
char
is greater than, equal to, or less than second
char
, ignoring case considerations in the ASCII range.public static boolean equalsIgnoreCase(char first, char second)
first
- the first char
to comparesecond
- the second char
to comparetrue
if the objects are the same, ignoring case
considerations; false
otherwise.public static boolean equalsIgnoreCaseAscii(char first, char second)
first
- the first char
to comparesecond
- the second char
to comparetrue
if the objects are the same, ignoring case
considerations; false
otherwise.public static boolean isAsciiDigit(char character)
This method provides higher performance than Character.isDigit(char)
while not checking Unicode character ranges.
character
- the character to be testedtrue
if the character is an ASCII digit; false
otherwise.public static boolean isAsciiLetter(char character)
This method provides higher performance than Character.isLetter(char)
while not checking Unicode character ranges. It returns true
for
characters A
to Z
and a
to z
.
character
- the character to be testedtrue
if the character is an ASCII letter; false
otherwise.public static boolean isAsciiWhitespace(char character)
This method provides higher performance than
Character.isWhitespace(char)
while not checking Unicode character
ranges. It is equivalent to white space checking of String.trim()
.
character
- the character to be testedtrue
if the character is an ASCII white space; false
otherwise.public static char toLowerCaseAscii(char character)
character
- the character to be converted.Character.isLowerCase(char)
,
String.toLowerCase()
public static char toUpperCaseAscii(char character)
character
- the character to be converted.Character.isUpperCase(char)
,
String.toUpperCase()
Copyright © 2025. All rights reserved.