Skip to content

Latest commit

 

History

History
46 lines (45 loc) · 12 KB

File metadata and controls

46 lines (45 loc) · 12 KB

Comprehensive List of Static Methods in the Character Class

Method Description Return Type Example
isDigit(char ch) Determines if the specified character is a digit. boolean Character.isDigit('5'); // true
isLetter(char ch) Determines if the specified character is a letter. boolean Character.isLetter('A'); // true
isLetterOrDigit(char ch) Determines if the specified character is a letter or digit. boolean Character.isLetterOrDigit('9'); // true
isLowerCase(char ch) Determines if the specified character is lowercase. boolean Character.isLowerCase('a'); // true
isUpperCase(char ch) Determines if the specified character is uppercase. boolean Character.isUpperCase('Z'); // true
isWhitespace(char ch) Determines if the specified character is a whitespace character. boolean Character.isWhitespace(' '); // true
isSpaceChar(char ch) Determines if the specified character is a space character. boolean Character.isSpaceChar(' '); // true
isISOControl(char ch) Determines if the specified character is an ISO control character. boolean Character.isISOControl('\u0001'); // true
isJavaIdentifierPart(char ch) Determines if the specified character is a valid part of a Java identifier. boolean Character.isJavaIdentifierPart('1'); // true
isJavaIdentifierStart(char ch) Determines if the specified character is a valid starting character for a Java identifier. boolean Character.isJavaIdentifierStart('_'); // true
isUnicodeIdentifierPart(char ch) Determines if the specified character may be part of a Unicode identifier. boolean Character.isUnicodeIdentifierPart('A'); // true
isUnicodeIdentifierStart(char ch) Determines if the specified character is permissible as the first character in a Unicode identifier. boolean Character.isUnicodeIdentifierStart('$'); // true
isIdentifierIgnorable(char ch) Determines if the specified character should be regarded as ignorable in an identifier. boolean Character.isIdentifierIgnorable('\u0000'); // true
toString(char c) Returns a String object representing the specified character. String Character.toString('A'); // "A"
getNumericValue(char ch) Returns the numeric value of the specified character. int Character.getNumericValue('7'); // 7
getType(char ch) Returns the general category type of the specified character. int Character.getType('A'); // 1
forDigit(int digit, int radix) Returns the character representation of the specified digit in the specified radix. char Character.forDigit(10, 16); // 'a'
isDefined(char ch) Determines if the specified character is defined in Unicode. boolean Character.isDefined('©'); // true
isTitleCase(char ch) Determines if the specified character is a titlecase character. boolean Character.isTitleCase('Dž'); // true
toLowerCase(char ch) Converts the specified character to lowercase. char Character.toLowerCase('A'); // 'a'
toUpperCase(char ch) Converts the specified character to uppercase. char Character.toUpperCase('b'); // 'B'
toTitleCase(char ch) Converts the specified character to titlecase. char Character.toTitleCase('Dž'); // 'Dž'
reverseBytes(char ch) Returns the value obtained by reversing the byte order of the specified character. char Character.reverseBytes('A'); // '\u4100'
charCount(int codePoint) Determines the number of char values needed to represent the specified Unicode code point. int Character.charCount(0x1F600); // 2
isBmpCodePoint(int codePoint) Determines if the specified code point is in the Basic Multilingual Plane (BMP). boolean Character.isBmpCodePoint(0xFFFF); // true
isValidCodePoint(int codePoint) Determines if the specified code point is a valid Unicode code point. boolean Character.isValidCodePoint(0x10FFFF); // true
isSupplementaryCodePoint(int codePoint) Determines if the specified code point is a supplementary character. boolean Character.isSupplementaryCodePoint(0x1F600); // true
toChars(int codePoint, char[] dst, int dstIndex) Converts a Unicode code point to its UTF-16 representation and stores it in a char array. int char[] dst = new char[2]; Character.toChars(0x1F600, dst, 0); // dst = ['😀']
toChars(int codePoint) Converts a Unicode code point to a char array. char[] Character.toChars(0x1F600); // ['😀']
toCodePoint(char high, char low) Converts a pair of surrogate values to a Unicode code point. int Character.toCodePoint('\uD83D', '\uDE00'); // 128512
codePointAt(char[] a, int index) Returns the code point at the specified index of a char array. int char[] a = {'A', '\uD83D', '\uDE00'}; Character.codePointAt(a, 1); // 128512
codePointAt(CharSequence seq, int index) Returns the code point at the specified index of a character sequence. int Character.codePointAt("Hello 😀", 6); // 128512
codePointBefore(char[] a, int index) Returns the code point before the specified index of a char array. int char[] a = {'A', '\uD83D', '\uDE00'}; Character.codePointBefore(a, 2); // 128512
codePointBefore(CharSequence seq, int index) Returns the code point before the specified index of a character sequence. int Character.codePointBefore("Hello 😀", 7); // 128512
codePointCount(char[] a, int offset, int count) Returns the number of Unicode code points in a subarray of the char array. int char[] a = {'A', '\uD83D', '\uDE00'}; Character.codePointCount(a, 0, 3); // 2
codePointCount(CharSequence seq, int beginIndex, int endIndex) Returns the number of Unicode code points in the specified text range of the character sequence. int Character.codePointCount("Hello 😀", 0, 8); // 7
offsetByCodePoints(char[] a, int start, int count) Returns the index within the char array that is offset by the specified number of code points. int char[] a = {'A', '\uD83D', '\uDE00'}; Character.offsetByCodePoints(a, 0, 2); // 3
offsetByCodePoints(CharSequence seq, int index, int codePointOffset) Returns the index within the character sequence that is offset by the specified number of code points. int Character.offsetByCodePoints("Hello 😀", 6, -1); // 5
isSurrogate(char ch) Determines if the specified character is a surrogate code unit. boolean Character.isSurrogate('\uD83D'); // true
isHighSurrogate(char ch) Determines if the specified character is a high-surrogate code unit. boolean Character.isHighSurrogate('\uD83D'); // true
isLowSurrogate(char ch) Determines if the specified character is a low-surrogate code unit. boolean Character.isLowSurrogate('\uDE00'); // true
isSurrogatePair(char high, char low) Determines if the specified pair of values is a valid surrogate pair. boolean