Java : Character with Examples

Character (Java SE 22 & JDK 22) with Examples.
You will find code examples on most Character methods.


Summary

The Character class wraps a value of the primitive type char in an object. An object of class Character contains a single field whose type is char.

Class diagram

// Compile error.
final var list = new ArrayList<char>();
// OK.
final var list = new ArrayList<Character>();
list.add('a');
list.add('b');
list.add('c');

System.out.println(list); // [a, b, c]
System.out.println(Character.isDigit('1')); // true
System.out.println(Character.isDigit('2')); // true
System.out.println(Character.isDigit('Z')); // false

System.out.println(Character.toUpperCase('a')); // A
System.out.println(Character.toUpperCase('b')); // B
System.out.println(Character.toUpperCase('c')); // C

Fields

static final int BYTES

The number of bytes used to represent a char value in unsigned binary form.

System.out.println(Character.BYTES); // 2

static final byte COMBINING_SPACING_MARK

General category "Mc" in the Unicode specification.

System.out.println(Character.COMBINING_SPACING_MARK); // 8

System.out.println(Character.getType('ः')); // 8
System.out.println(Character.getType('ᤣ')); // 8

static final byte CONNECTOR_PUNCTUATION

General category "Pc" in the Unicode specification.

System.out.println(Character.CONNECTOR_PUNCTUATION); // 23

System.out.println(Character.getType('_')); // 23
System.out.println(Character.getType('﹏')); // 23

static final byte CONTROL

General category "Cc" in the Unicode specification.

System.out.println(Character.CONTROL); // 15

System.out.println(Character.getType('\u0000')); // 15
System.out.println(Character.getType('\u001b')); // 15

static final byte CURRENCY_SYMBOL

General category "Sc" in the Unicode specification.

System.out.println(Character.CURRENCY_SYMBOL); // 26

System.out.println(Character.getType('$')); // 26
System.out.println(Character.getType('¥')); // 26

static final byte DASH_PUNCTUATION

General category "Pd" in the Unicode specification.

System.out.println(Character.DASH_PUNCTUATION); // 20

System.out.println(Character.getType('-')); // 20
System.out.println(Character.getType('〜')); // 20

static final byte DECIMAL_DIGIT_NUMBER

General category "Nd" in the Unicode specification.

System.out.println(Character.DECIMAL_DIGIT_NUMBER); // 9

System.out.println(Character.getType('1')); // 9
System.out.println(Character.getType('2')); // 9

static final byte DIRECTIONALITY_ARABIC_NUMBER

Weak bidirectional character type "AN" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_ARABIC_NUMBER); // 6

System.out.println(Character.getDirectionality('٠')); // 6
System.out.println(Character.getDirectionality('٢')); // 6

static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL

Weak bidirectional character type "BN" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_BOUNDARY_NEUTRAL); // 9

System.out.println(Character.getDirectionality('\u0000')); // 9
System.out.println(Character.getDirectionality('\u001b')); // 9

static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR

Weak bidirectional character type "CS" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR); // 7

System.out.println(Character.getDirectionality(',')); // 7
System.out.println(Character.getDirectionality(':')); // 7

static final byte DIRECTIONALITY_EUROPEAN_NUMBER

Weak bidirectional character type "EN" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_EUROPEAN_NUMBER); // 3

System.out.println(Character.getDirectionality('1')); // 3
System.out.println(Character.getDirectionality('2')); // 3

static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR

Weak bidirectional character type "ES" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR); // 4

System.out.println(Character.getDirectionality('+')); // 4
System.out.println(Character.getDirectionality('-')); // 4

static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR

Weak bidirectional character type "ET" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR); // 5

System.out.println(Character.getDirectionality('#')); // 5
System.out.println(Character.getDirectionality('$')); // 5

static final byte DIRECTIONALITY_FIRST_STRONG_ISOLATE

Weak bidirectional character type "FSI" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_FIRST_STRONG_ISOLATE); // 21

System.out.println(Character.getDirectionality('\u2068')); // 21

static final byte DIRECTIONALITY_LEFT_TO_RIGHT

Strong bidirectional character type "L" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_LEFT_TO_RIGHT); // 0

System.out.println(Character.getDirectionality('A')); // 0
System.out.println(Character.getDirectionality('B')); // 0

static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING

Strong bidirectional character type "LRE" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING); // 14

System.out.println(Character.getDirectionality('\u202a')); // 14

static final byte DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE

Weak bidirectional character type "LRI" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE); // 19

System.out.println(Character.getDirectionality('\u2066')); // 19

static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE

Strong bidirectional character type "LRO" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE); // 15

System.out.println(Character.getDirectionality('\u202d')); // 15

static final byte DIRECTIONALITY_NONSPACING_MARK

Weak bidirectional character type "NSM" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_NONSPACING_MARK); // 8

System.out.println(Character.getDirectionality('̀')); // 8
System.out.println(Character.getDirectionality('̃')); // 8

static final byte DIRECTIONALITY_OTHER_NEUTRALS

Neutral bidirectional character type "ON" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_OTHER_NEUTRALS); // 13

System.out.println(Character.getDirectionality('!')); // 13
System.out.println(Character.getDirectionality('&')); // 13

static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR

Neutral bidirectional character type "B" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR); // 10

System.out.println(Character.getDirectionality('\n')); // 10
System.out.println(Character.getDirectionality('\r')); // 10

static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT

Weak bidirectional character type "PDF" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT); // 18

System.out.println(Character.getDirectionality('\u202c')); // 18

static final byte DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE

Weak bidirectional character type "PDI" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE); // 22

System.out.println(Character.getDirectionality('\u2069')); // 22

static final byte DIRECTIONALITY_RIGHT_TO_LEFT

Strong bidirectional character type "R" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_RIGHT_TO_LEFT); // 1

System.out.println(Character.getDirectionality('א')); // 1
System.out.println(Character.getDirectionality('ט')); // 1

static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC

Strong bidirectional character type "AL" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC); // 2

System.out.println(Character.getDirectionality('؈')); // 2
System.out.println(Character.getDirectionality('ب')); // 2

static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING

Strong bidirectional character type "RLE" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING); // 16

System.out.println(Character.getDirectionality('\u202b')); // 16

static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE

Weak bidirectional character type "RLI" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE); // 20

System.out.println(Character.getDirectionality('\u2067')); // 20

static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE

Strong bidirectional character type "RLO" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE); // 17

System.out.println(Character.getDirectionality('\u202e')); // 17

static final byte DIRECTIONALITY_SEGMENT_SEPARATOR

Neutral bidirectional character type "S" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_SEGMENT_SEPARATOR); // 11

System.out.println(Character.getDirectionality('\t')); // 11

static final byte DIRECTIONALITY_UNDEFINED

Undefined bidirectional character type.

System.out.println(Character.DIRECTIONALITY_UNDEFINED); // -1

System.out.println(Character.getDirectionality('\uFFFF')); // -1

static final byte DIRECTIONALITY_WHITESPACE

Neutral bidirectional character type "WS" in the Unicode specification.

System.out.println(Character.DIRECTIONALITY_WHITESPACE); // 12

System.out.println(Character.getDirectionality(' ')); // 12

static final byte ENCLOSING_MARK

General category "Me" in the Unicode specification.

System.out.println(Character.ENCLOSING_MARK); // 7

System.out.println(Character.getType('⃣')); // 7
System.out.println(Character.getType('⃠')); // 7

static final byte END_PUNCTUATION

General category "Pe" in the Unicode specification.

System.out.println(Character.END_PUNCTUATION); // 22

System.out.println(Character.getType(')')); // 22
System.out.println(Character.getType(']')); // 22

static final byte FINAL_QUOTE_PUNCTUATION

General category "Pf" in the Unicode specification.

System.out.println(Character.FINAL_QUOTE_PUNCTUATION); // 30

System.out.println(Character.getType('”')); // 30
System.out.println(Character.getType('»')); // 30

static final byte FORMAT

General category "Cf" in the Unicode specification.

System.out.println(Character.FORMAT); // 16

System.out.println(Character.getType('\u00ad')); // 16

static final byte INITIAL_QUOTE_PUNCTUATION

General category "Pi" in the Unicode specification.

System.out.println(Character.INITIAL_QUOTE_PUNCTUATION); // 29

System.out.println(Character.getType('“')); // 29
System.out.println(Character.getType('«')); // 29

static final byte LETTER_NUMBER

General category "Nl" in the Unicode specification.

System.out.println(Character.LETTER_NUMBER); // 10

System.out.println(Character.getType('Ⅱ')); // 10
System.out.println(Character.getType('ᛯ')); // 10

static final byte LINE_SEPARATOR

General category "Zl" in the Unicode specification.

System.out.println(Character.LINE_SEPARATOR); // 13

System.out.println(Character.getType('\u2028')); // 13

static final byte LOWERCASE_LETTER

General category "Ll" in the Unicode specification.

System.out.println(Character.LOWERCASE_LETTER); // 2

System.out.println(Character.getType('a')); // 2
System.out.println(Character.getType('ē')); // 2

static final byte MATH_SYMBOL

General category "Sm" in the Unicode specification.

System.out.println(Character.MATH_SYMBOL); // 25

System.out.println(Character.getType('+')); // 25
System.out.println(Character.getType('=')); // 25

static final int MAX_CODE_POINT

The maximum value of a Unicode code point, constant U+10FFFF.

System.out.printf("%x%n", Character.MAX_CODE_POINT); // 10ffff

static final char MAX_HIGH_SURROGATE

The maximum value of a Unicode high-surrogate code unit in the UTF-16 encoding, constant '\uDBFF'.

System.out.println(Integer.toHexString(Character.MAX_HIGH_SURROGATE)); // dbff

static final char MAX_LOW_SURROGATE

The maximum value of a Unicode low-surrogate code unit in the UTF-16 encoding, constant '\uDFFF'.

System.out.println(Integer.toHexString(Character.MAX_LOW_SURROGATE)); // dfff

static final int MAX_RADIX

The maximum radix available for conversion to and from strings.

System.out.println(Character.MAX_RADIX); // 36

static final char MAX_SURROGATE

The maximum value of a Unicode surrogate code unit in the UTF-16 encoding, constant '\uDFFF'.

System.out.println(Integer.toHexString(Character.MAX_SURROGATE)); // dfff

static final char MAX_VALUE

The constant value of this field is the largest value of type char, '\uFFFF'.

System.out.println(Integer.toHexString(Character.MAX_VALUE)); // ffff

static final int MIN_CODE_POINT

The minimum value of a Unicode code point, constant U+0000.

System.out.println(Integer.toHexString(Character.MIN_CODE_POINT)); // 0

static final char MIN_HIGH_SURROGATE

The minimum value of a Unicode high-surrogate code unit in the UTF-16 encoding, constant '\uD800'.

System.out.println(Integer.toHexString(Character.MIN_HIGH_SURROGATE)); // d800

static final char MIN_LOW_SURROGATE

The minimum value of a Unicode low-surrogate code unit in the UTF-16 encoding, constant '\uDC00'.

System.out.println(Integer.toHexString(Character.MIN_LOW_SURROGATE)); // dc00

static final int MIN_RADIX

The minimum radix available for conversion to and from strings.

System.out.println(Character.MIN_RADIX); // 2

static final int MIN_SUPPLEMENTARY_CODE_POINT

The minimum value of a Unicode supplementary code point, constant U+10000.

final var value = Character.MIN_SUPPLEMENTARY_CODE_POINT;
System.out.println(Integer.toHexString(value)); // 10000

static final char MIN_SURROGATE

The minimum value of a Unicode surrogate code unit in the UTF-16 encoding, constant '\uD800'.

System.out.println(Integer.toHexString(Character.MIN_SURROGATE)); // d800

static final char MIN_VALUE

The constant value of this field is the smallest value of type char, '\u0000'.

System.out.println(Integer.toHexString(Character.MIN_VALUE)); // 0

static final byte MODIFIER_LETTER

General category "Lm" in the Unicode specification.

System.out.println(Character.MODIFIER_LETTER); // 4

System.out.println(Character.getType('ʰ')); // 4
System.out.println(Character.getType('ʺ')); // 4

static final byte MODIFIER_SYMBOL

General category "Sk" in the Unicode specification.

System.out.println(Character.MODIFIER_SYMBOL); // 27

System.out.println(Character.getType('^')); // 27
System.out.println(Character.getType('`')); // 27

static final byte NON_SPACING_MARK

General category "Mn" in the Unicode specification.

System.out.println(Character.NON_SPACING_MARK); // 6

System.out.println(Character.getType('̈')); // 6
System.out.println(Character.getType('̆')); // 6

static final byte OTHER_LETTER

General category "Lo" in the Unicode specification.

System.out.println(Character.OTHER_LETTER); // 5

System.out.println(Character.getType('ª')); // 5
System.out.println(Character.getType('ƻ')); // 5

static final byte OTHER_NUMBER

General category "No" in the Unicode specification.

System.out.println(Character.OTHER_NUMBER); // 11

System.out.println(Character.getType('¼')); // 11
System.out.println(Character.getType('①')); // 11

static final byte OTHER_PUNCTUATION

General category "Po" in the Unicode specification.

System.out.println(Character.OTHER_PUNCTUATION); // 24

System.out.println(Character.getType('!')); // 24
System.out.println(Character.getType('#')); // 24

static final byte OTHER_SYMBOL

General category "So" in the Unicode specification.

System.out.println(Character.OTHER_SYMBOL); // 28

System.out.println(Character.getType('¦')); // 28
System.out.println(Character.getType('҂')); // 28

static final byte PARAGRAPH_SEPARATOR

General category "Zp" in the Unicode specification.

System.out.println(Character.PARAGRAPH_SEPARATOR); // 14

System.out.println(Character.getType('\u2029')); // 14

static final byte PRIVATE_USE

General category "Co" in the Unicode specification.

System.out.println(Character.PRIVATE_USE); // 18

System.out.println(Character.getType('\ue000')); // 18

static final int SIZE

The number of bits used to represent a char value in unsigned binary form, constant 16.

System.out.println(Character.SIZE); // 16

static final byte SPACE_SEPARATOR

General category "Zs" in the Unicode specification.

System.out.println(Character.SPACE_SEPARATOR); // 12

System.out.println(Character.getType(' ')); // 12

static final byte START_PUNCTUATION

General category "Ps" in the Unicode specification.

System.out.println(Character.START_PUNCTUATION); // 21

System.out.println(Character.getType('(')); // 21
System.out.println(Character.getType('[')); // 21

static final byte SURROGATE

General category "Cs" in the Unicode specification.

System.out.println(Character.SURROGATE); // 19

System.out.println(Character.getType(Character.MIN_SURROGATE)); // 19
System.out.println(Character.getType(Character.MAX_SURROGATE)); // 19

static final byte TITLECASE_LETTER

General category "Lt" in the Unicode specification.

System.out.println(Character.TITLECASE_LETTER); // 3

System.out.println(Character.getType('Dž')); // 3
System.out.println(Character.getType('Lj')); // 3

static final Class<Character> TYPE

The Class instance representing the primitive type char.

System.out.println(Character.TYPE.getName()); // char
System.out.println(Character.TYPE.isPrimitive()); // true

static final byte UNASSIGNED

General category "Cn" in the Unicode specification.

System.out.println(Character.UNASSIGNED); // 0

System.out.println(Character.getType('\uFFFF')); // 0

static final byte UPPERCASE_LETTER

General category "Lu" in the Unicode specification.

System.out.println(Character.UPPERCASE_LETTER); // 1

System.out.println(Character.getType('A')); // 1
System.out.println(Character.getType('Ê')); // 1

Constructors

Character (char value)

Deprecated, for removal: This API element is subject to removal in a future version. It is rarely appropriate to use this constructor.

Deprecated.

Methods

static int charCount (int codePoint)

Determines the number of char values needed to represent the specified character (Unicode code point).

final var ret1 = Character.charCount('a');
System.out.println(ret1); // 1

final var ret2 = Character.charCount('△');
System.out.println(ret2); // 1
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.println(Character.toString(codePoint)); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var ret = Character.charCount(codePoint);
System.out.println(ret); // 2

char charValue ()

Returns the value of this Character object.

final var c = Character.valueOf('a');
System.out.println(c); // a
System.out.println(c.charValue()); // a
final var c = Character.valueOf('△');
System.out.println(c); // △
System.out.println(c.charValue()); // △

static int codePointAt (char[] a, int index)

Returns the code point at the given index of the char array.

final char[] a = "abc".toCharArray();
System.out.println(Arrays.toString(a)); // [a, b, c]

final var ret1 = Character.codePointAt(a, 0);
System.out.println(Character.toString(ret1)); // a

final var ret2 = Character.codePointAt(a, 1);
System.out.println(Character.toString(ret2)); // b

final var ret3 = Character.codePointAt(a, 2);
System.out.println(Character.toString(ret3)); // c

try {
    Character.codePointAt(a, 3);
} catch (IndexOutOfBoundsException e) {
    System.out.println(e);
}

// Result
// ↓
//java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.println(Character.toString(codePoint)); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var seq = Character.toString(codePoint) + "ab";
System.out.println(seq); // "𝟝ab"

final char[] a = seq.toCharArray();
System.out.println(Arrays.toString(a)); // [?, ?, a, b]

final var ret1 = Character.codePointAt(a, 0);
System.out.printf("%c%n", ret1); // 𝟝

final var ret2 = Character.codePointAt(a, 1);
System.out.printf("%c%n", ret2); // ?
System.out.printf("%x%n", ret2); // dfdd

final var ret3 = Character.codePointAt(a, 2);
System.out.printf("%c%n", ret3); // a

final var ret4 = Character.codePointAt(a, 3);
System.out.printf("%c%n", ret4); // b

static int codePointAt (char[] a, int index, int limit)

Returns the code point at the given index of the char array, where only array elements with index less than limit can be used.

Please see also : codePointAt(char[] a, int index)

final char[] a = "abc".toCharArray();
System.out.println(Arrays.toString(a)); // [a, b, c]

final var ret1 = Character.codePointAt(a, 0, 2);
System.out.printf("%c%n", ret1); // a

final var ret2 = Character.codePointAt(a, 1, 2);
System.out.printf("%c%n", ret2); // b

try {
    Character.codePointAt(a, 2, 2);
} catch (IndexOutOfBoundsException e) {
    System.out.println(e);
}

// Result
// ↓
//java.lang.IndexOutOfBoundsException
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.println(Character.toString(codePoint)); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final char[] a = Character.toChars(codePoint);
System.out.println(Arrays.toString(a)); // [?, ?]

final var ret1 = Character.codePointAt(a, 0, 2);
System.out.printf("%c%n", ret1); // 𝟝

final var ret2 = Character.codePointAt(a, 1, 2);
System.out.printf("%c%n", ret2); // ?
System.out.printf("%x%n", ret2); // dfdd

final var ret3 = Character.codePointAt(a, 0, 1);
System.out.printf("%c%n", ret3); // ?
System.out.printf("%x%n", ret3); // d835

try {
    Character.codePointAt(a, 1, 1);
} catch (IndexOutOfBoundsException e) {
    System.out.println(e);
}

// Result
// ↓
//java.lang.IndexOutOfBoundsException

static int codePointAt (CharSequence seq, int index)

Returns the code point at the given index of the CharSequence.

final var seq = "abc";
System.out.println(seq); // abc

final var ret1 = Character.codePointAt(seq, 0);
System.out.printf("%c%n", ret1); // a

final var ret2 = Character.codePointAt(seq, 1);
System.out.printf("%c%n", ret2); // b

final var ret3 = Character.codePointAt(seq, 2);
System.out.printf("%c%n", ret3); // c

try {
    Character.codePointAt(seq, 3);
} catch (IndexOutOfBoundsException e) {
    System.out.println(e);
}

// Result
// ↓
//java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.println(Character.toString(codePoint)); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var seq = Character.toString(codePoint) + "ab";
System.out.println(seq); // 𝟝ab

final var ret1 = Character.codePointAt(seq, 0);
System.out.printf("%c%n", ret1); // 𝟝

final var ret2 = Character.codePointAt(seq, 1);
System.out.printf("%c%n", ret2); // ?
System.out.printf("%x%n", ret2); // dfdd

final var ret3 = Character.codePointAt(seq, 2);
System.out.printf("%c%n", ret3); // a

final var ret4 = Character.codePointAt(seq, 3);
System.out.printf("%c%n", ret4); // b

static int codePointBefore (char[] a, int index)

Returns the code point preceding the given index of the char array.

final char[] a = "abc".toCharArray();
System.out.println(Arrays.toString(a)); // [a, b, c]

final var ret1 = Character.codePointBefore(a, 1);
System.out.printf("%c%n", ret1); // a

final var ret2 = Character.codePointBefore(a, 2);
System.out.printf("%c%n", ret2); // b

final var ret3 = Character.codePointBefore(a, 3);
System.out.printf("%c%n", ret3); // c

try {
    Character.codePointBefore(a, 0);
} catch (IndexOutOfBoundsException e) {
    System.out.println(e);
}

// Result
// ↓
//java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 3
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.println(Character.toString(codePoint)); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var seq = Character.toString(codePoint) + "ab";
System.out.println(seq); // 𝟝ab

final char[] a = seq.toCharArray();
System.out.println(Arrays.toString(a)); // [?, ?, a, b]

final var ret1 = Character.codePointBefore(a, 1);
System.out.printf("%c%n", ret1); // ?
System.out.printf("%x%n", ret1); // d835

final var ret2 = Character.codePointBefore(a, 2);
System.out.printf("%c%n", ret2); // 𝟝

final var ret3 = Character.codePointBefore(a, 3);
System.out.printf("%c%n", ret3); // a

final var ret4 = Character.codePointBefore(a, 4);
System.out.printf("%c%n", ret4); // b

static int codePointBefore (char[] a, int index, int start)

Returns the code point preceding the given index of the char array, where only array elements with index greater than or equal to start can be used.

Please see also : codePointBefore(char[] a, int index)

final char[] a = "abc".toCharArray();
System.out.println(Arrays.toString(a)); // [a, b, c]

final var ret1 = Character.codePointBefore(a, 2, 1);
System.out.printf("%c%n", ret1); // b

final var ret2 = Character.codePointBefore(a, 3, 1);
System.out.printf("%c%n", ret2); // c

try {
    Character.codePointBefore(a, 1, 1);
} catch (IndexOutOfBoundsException e) {
    System.out.println(e);
}

// Result
// ↓
//java.lang.IndexOutOfBoundsException
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.println(Character.toString(codePoint)); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var seq = Character.toString(codePoint) + "ab";
System.out.println(seq); // 𝟝ab

final char[] a = seq.toCharArray();
System.out.println(Arrays.toString(a)); // [?, ?, a, b]

final var ret1 = Character.codePointBefore(a, 2, 1);
System.out.printf("%c%n", ret1); // ?
System.out.printf("%x%n", ret1); // dfdd

final var ret2 = Character.codePointBefore(a, 3, 1);
System.out.printf("%c%n", ret2); // a

final var ret3 = Character.codePointBefore(a, 4, 1);
System.out.printf("%c%n", ret3); // b

static int codePointBefore (CharSequence seq, int index)

Returns the code point preceding the given index of the CharSequence.

final var seq = "abc";
System.out.println(seq); // abc

final var ret1 = Character.codePointBefore(seq, 1);
System.out.printf("%c%n", ret1); // a

final var ret2 = Character.codePointBefore(seq, 2);
System.out.printf("%c%n", ret2); // b

final var ret3 = Character.codePointBefore(seq, 3);
System.out.printf("%c%n", ret3); // c

try {
    Character.codePointBefore(seq, 0);
} catch (IndexOutOfBoundsException e) {
    System.out.println(e);
}

// Result
// ↓
//java.lang.StringIndexOutOfBoundsException: Index -1 out of bounds for length 3
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.println(Character.toString(codePoint)); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var seq = Character.toString(codePoint) + "ab";
System.out.println(seq); // 𝟝ab

final var ret1 = Character.codePointBefore(seq, 1);
System.out.printf("%c%n", ret1); // ?
System.out.printf("%x%n", ret1); // d835

final var ret2 = Character.codePointBefore(seq, 2);
System.out.printf("%c%n", ret2); // 𝟝

final var ret3 = Character.codePointBefore(seq, 3);
System.out.printf("%c%n", ret3); // a

final var ret4 = Character.codePointBefore(seq, 4);
System.out.printf("%c%n", ret4); // b

static int codePointCount (char[] a, int offset, int count)

Returns the number of Unicode code points in a subarray of the char array argument.

final char[] a = "abc".toCharArray();
System.out.println(Arrays.toString(a)); // [a, b, c]

System.out.println(Character.codePointCount(a, 0, 0)); // 0
System.out.println(Character.codePointCount(a, 0, 1)); // 1
System.out.println(Character.codePointCount(a, 0, 2)); // 2
System.out.println(Character.codePointCount(a, 0, 3)); // 3
//Character.codePointCount(a, 0, 4); // IndexOutOfBoundsException

System.out.println(Character.codePointCount(a, 0, 3)); // 3
System.out.println(Character.codePointCount(a, 1, 2)); // 2
System.out.println(Character.codePointCount(a, 2, 1)); // 1
System.out.println(Character.codePointCount(a, 3, 0)); // 0
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.println(Character.toString(codePoint)); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var seq = Character.toString(codePoint) + "ab";
System.out.println(seq); // 𝟝ab

final char[] a = seq.toCharArray();
System.out.println(Arrays.toString(a)); // [?, ?, a, b]

System.out.println(Character.codePointCount(a, 0, 0)); // 0
System.out.println(Character.codePointCount(a, 0, 1)); // 1
System.out.println(Character.codePointCount(a, 0, 2)); // 1
System.out.println(Character.codePointCount(a, 0, 3)); // 2
System.out.println(Character.codePointCount(a, 0, 4)); // 3

static int codePointCount (CharSequence seq, int beginIndex, int endIndex)

Returns the number of Unicode code points in the text range of the specified char sequence.

final var seq = "abc";
System.out.println(seq); // [a, b, c]

System.out.println(Character.codePointCount(seq, 0, 0)); // 0
System.out.println(Character.codePointCount(seq, 0, 1)); // 1
System.out.println(Character.codePointCount(seq, 0, 2)); // 2
System.out.println(Character.codePointCount(seq, 0, 3)); // 3
//Character.codePointCount(seq, 0, 4); // IndexOutOfBoundsException

System.out.println(Character.codePointCount(seq, 0, 3)); // 3
System.out.println(Character.codePointCount(seq, 1, 3)); // 2
System.out.println(Character.codePointCount(seq, 2, 3)); // 1
System.out.println(Character.codePointCount(seq, 3, 3)); // 0
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.println(Character.toString(codePoint)); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var seq = Character.toString(codePoint) + "ab";
System.out.println(seq); // 𝟝ab

System.out.println(Character.codePointCount(seq, 0, 0)); // 0
System.out.println(Character.codePointCount(seq, 0, 1)); // 1
System.out.println(Character.codePointCount(seq, 0, 2)); // 1
System.out.println(Character.codePointCount(seq, 0, 3)); // 2
System.out.println(Character.codePointCount(seq, 0, 4)); // 3

static int codePointOf (String name)

Returns the code point value of the Unicode character specified by the given character name.

final var ret1 = Character.codePointOf("LATIN SMALL LETTER A");
System.out.printf("%c%n", ret1); // a

final var ret2 = Character.codePointOf("LATIN SMALL LETTER B");
System.out.printf("%c%n", ret2); // b

final var ret3 = Character.codePointOf("WHITE UP-POINTING TRIANGLE");
System.out.printf("%c%n", ret3); // △

final var ret4 = Character.codePointOf("MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE");
System.out.printf("%c%n", ret4); // 𝟝

static int compare (char x, char y)

Compares two char values numerically.

System.out.println(Character.compare('a', 'a')); // 0
System.out.println(Character.compare('a', 'b')); // -1
System.out.println(Character.compare('9', '0')); // 9
System.out.println(Character.compare('Z', 'Y')); // 1
System.out.println(Character.compare('□', '△')); // -18
System.out.println(Character.compare('a', 'A')); // 32

int compareTo (Character anotherCharacter)

Compares two Character objects numerically.

final var value1 = Character.valueOf('a');
final var value2 = Character.valueOf('a');

System.out.println(value1.compareTo(value2)); // 0
final var value1 = Character.valueOf('a');
final var value2 = Character.valueOf('b');

System.out.println(value1.compareTo(value2)); // -1
final var value1 = Character.valueOf('9');
final var value2 = Character.valueOf('0');

System.out.println(value1.compareTo(value2)); // 9
final var value1 = Character.valueOf('Z');
final var value2 = Character.valueOf('Y');

System.out.println(value1.compareTo(value2)); // 1
final var value1 = Character.valueOf('□');
final var value2 = Character.valueOf('△');

System.out.println(value1.compareTo(value2)); // -18
final var value1 = Character.valueOf('a');
final var value2 = Character.valueOf('A');

System.out.println(value1.compareTo(value2)); // 32

Optional<DynamicConstantDesc<Character>> describeConstable ()

Returns an Optional containing the nominal descriptor for this instance.

final var ret = Character.valueOf('a').describeConstable();

// Optional[DynamicConstantDesc[ConstantBootstraps::explicitCast(97)char]]
System.out.println(ret);

static int digit (char ch, int radix)

Returns the numeric value of the character ch in the specified radix.

System.out.println(Character.digit('0', 10)); // 0
System.out.println(Character.digit('1', 10)); // 1
System.out.println(Character.digit('2', 10)); // 2
System.out.println(Character.digit('3', 10)); // 3
System.out.println(Character.digit('4', 10)); // 4
System.out.println(Character.digit('5', 10)); // 5
System.out.println(Character.digit('6', 10)); // 6
System.out.println(Character.digit('7', 10)); // 7
System.out.println(Character.digit('8', 10)); // 8
System.out.println(Character.digit('9', 10)); // 9
System.out.println(Character.digit('a', 10)); // -1
final var a = "0123456789abcdefABCDEF".toCharArray();

for (char ch : a) {
    System.out.printf("ch = %c : %d%n", ch, Character.digit(ch, 16));
}

// Result
// ↓
//ch = 0 : 0
//ch = 1 : 1
//ch = 2 : 2
//ch = 3 : 3
//ch = 4 : 4
//ch = 5 : 5
//ch = 6 : 6
//ch = 7 : 7
//ch = 8 : 8
//ch = 9 : 9
//ch = a : 10
//ch = b : 11
//ch = c : 12
//ch = d : 13
//ch = e : 14
//ch = f : 15
//ch = A : 10
//ch = B : 11
//ch = C : 12
//ch = D : 13
//ch = E : 14
//ch = F : 15

static int digit (int codePoint, int radix)

Returns the numeric value of the specified character (Unicode code point) in the specified radix.

Please see also : digit(char ch, int radix)

final var codePoint = Character.toCodePoint('\uD835', '\uDFD8');

// MATHEMATICAL DOUBLE-STRUCK DIGIT ZERO
System.out.println(Character.getName(codePoint));

System.out.printf("%c%n", codePoint); // 𝟘
System.out.println(Character.digit(codePoint, 10)); // 0
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.printf("%c%n", codePoint); // 𝟝
System.out.println(Character.digit(codePoint, 10)); // 5

boolean equals (Object obj)

Compares this object against the specified object.

final var value1 = Character.valueOf('a');
final var value2 = Character.valueOf('a');

System.out.println(value1.equals(value2)); // true
final var value1 = Character.valueOf('a');
final var value2 = Character.valueOf('b');

System.out.println(value1.equals(value2)); // false
final var value1 = Character.valueOf('9');
final var value2 = Character.valueOf('0');

System.out.println(value1.equals(value2)); // false
final var value1 = Character.valueOf('Z');
final var value2 = Character.valueOf('Y');

System.out.println(value1.equals(value2)); // false
final var value1 = Character.valueOf('□');
final var value2 = Character.valueOf('△');

System.out.println(value1.equals(value2)); // false
final var value1 = Character.valueOf('a');
final var value2 = Character.valueOf('A');

System.out.println(value1.equals(value2)); // false

static char forDigit (int digit, int radix)

Determines the character representation for a specific digit in the specified radix.

System.out.printf("%c%n", Character.forDigit(0, 10)); // 0
System.out.printf("%c%n", Character.forDigit(1, 10)); // 1
System.out.printf("%c%n", Character.forDigit(2, 10)); // 2
System.out.printf("%c%n", Character.forDigit(3, 10)); // 3
System.out.printf("%c%n", Character.forDigit(4, 10)); // 4
System.out.printf("%c%n", Character.forDigit(5, 10)); // 5
System.out.printf("%c%n", Character.forDigit(6, 10)); // 6
System.out.printf("%c%n", Character.forDigit(7, 10)); // 7
System.out.printf("%c%n", Character.forDigit(8, 10)); // 8
System.out.printf("%c%n", Character.forDigit(9, 10)); // 9

System.out.println(Character.forDigit(10, 10) == '\0'); // true
for (int i = 0; i < 16; i++) {
    System.out.printf("digit = %d : %c%n", i, Character.forDigit(i, 16));
}

// Result
// ↓
//digit = 0 : 0
//digit = 1 : 1
//digit = 2 : 2
//digit = 3 : 3
//digit = 4 : 4
//digit = 5 : 5
//digit = 6 : 6
//digit = 7 : 7
//digit = 8 : 8
//digit = 9 : 9
//digit = 10 : a
//digit = 11 : b
//digit = 12 : c
//digit = 13 : d
//digit = 14 : e
//digit = 15 : f

static byte getDirectionality (char ch)

Returns the Unicode directionality property for the given character.

System.out.println(Character.DIRECTIONALITY_EUROPEAN_NUMBER); // 3

System.out.println(Character.getDirectionality('1')); // 3
System.out.println(Character.getDirectionality('2')); // 3
System.out.println(Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR); // 10

System.out.println(Character.getDirectionality('\n')); // 10
System.out.println(Character.getDirectionality('\r')); // 10

static byte getDirectionality (int codePoint)

Returns the Unicode directionality property for the given character (Unicode code point).

Please see also : getDirectionality(char ch)

System.out.println(Character.DIRECTIONALITY_EUROPEAN_NUMBER); // 3

final var codePoint1 = Character.toCodePoint('\uD835', '\uDFD8');
System.out.printf("%c%n", codePoint1); // 𝟘
System.out.println(Character.getDirectionality(codePoint1)); // 3

final var codePoint2 = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint2); // 𝟝
System.out.println(Character.getDirectionality(codePoint2)); // 3

static String getName (int codePoint)

Returns the name of the specified character codePoint, or null if the code point is unassigned.

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));
"abc".codePoints().forEach(codePoint -> {
    System.out.printf("%c : %s%n", codePoint, Character.getName(codePoint));
});

// Result
// ↓
//a : LATIN SMALL LETTER A
//b : LATIN SMALL LETTER B
//c : LATIN SMALL LETTER C

static int getNumericValue (char ch)

Returns the int value that the specified Unicode character represents.

System.out.println(Character.getNumericValue('0')); // 0
System.out.println(Character.getNumericValue('1')); // 1
System.out.println(Character.getNumericValue('2')); // 2
System.out.println(Character.getNumericValue('3')); // 3
System.out.println(Character.getNumericValue('⑩')); // 10
System.out.println(Character.getNumericValue('Ⅺ')); // 11
System.out.println(Character.getNumericValue('⒓')); // 12
final var ch = '\u216C';
System.out.printf("%c%n", ch); // Ⅼ
System.out.println(Character.getNumericValue(ch)); // 50

static int getNumericValue (int codePoint)

Returns the int value that the specified character (Unicode code point) represents.

Please see also : getNumericValue(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.getNumericValue(codePoint)); // 5
"ⅩⅪⅫ".codePoints().forEach(codePoint -> {
    System.out.printf("%c : %d%n", codePoint, Character.getNumericValue(codePoint));
});

// Result
// ↓
//Ⅹ : 10
//Ⅺ : 11
//Ⅻ : 12

static int getType (char ch)

Returns a value indicating a character's general category.

System.out.println(Character.DECIMAL_DIGIT_NUMBER); // 9

System.out.println(Character.getType('1')); // 9
System.out.println(Character.getType('2')); // 9
System.out.println(Character.DASH_PUNCTUATION); // 20

System.out.println(Character.getType('-')); // 20
System.out.println(Character.getType('〜')); // 20

static int getType (int codePoint)

Returns a value indicating a character's general category.

Please see also : getType(char ch)

System.out.println(Character.DECIMAL_DIGIT_NUMBER); // 9

final var codePoint1 = Character.toCodePoint('\uD835', '\uDFD8');
System.out.printf("%c%n", codePoint1); // 𝟘
System.out.println(Character.getType(codePoint1)); // 9

final var codePoint2 = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint2); // 𝟝
System.out.println(Character.getType(codePoint2)); // 9

int hashCode ()

Returns a hash code for this Character; equal to the result of invoking charValue().

System.out.println(Character.valueOf('a').hashCode()); // 97
System.out.println(Character.valueOf('b').hashCode()); // 98
System.out.println(Character.valueOf('c').hashCode()); // 99
System.out.println(Character.valueOf('□').hashCode()); // 9633
System.out.println(Character.valueOf('△').hashCode()); // 9651

static int hashCode (char value)

Returns a hash code for a char value; compatible with Character.hashCode().

System.out.println(Character.hashCode('a')); // 97
System.out.println(Character.hashCode('b')); // 98
System.out.println(Character.hashCode('c')); // 99
System.out.println(Character.hashCode('□')); // 9633
System.out.println(Character.hashCode('△')); // 9651

static char highSurrogate (int codePoint)

Returns the leading surrogate (a high surrogate code unit) of the surrogate pair representing the specified supplementary character (Unicode code point) in the UTF-16 encoding.

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var high = Character.highSurrogate(codePoint);
System.out.println(Integer.toHexString(high)); // d835

final var low = Character.lowSurrogate(codePoint);
System.out.println(Integer.toHexString(low)); // dfdd

static boolean isAlphabetic (int codePoint)

Determines if the specified character (Unicode code point) is alphabetic.

System.out.println(Character.isAlphabetic('a')); // true
System.out.println(Character.isAlphabetic('b')); // true
System.out.println(Character.isAlphabetic('X')); // true
System.out.println(Character.isAlphabetic('Y')); // true

System.out.println(Character.isAlphabetic('0')); // false
System.out.println(Character.isAlphabetic('1')); // false
System.out.println(Character.isAlphabetic('2')); // false

System.out.println(Character.isAlphabetic('□')); // false
System.out.println(Character.isAlphabetic('△')); // false

System.out.println(Character.isAlphabetic('Dž')); // true
System.out.println(Character.isAlphabetic('Lj')); // true

static boolean isBmpCodePoint (int codePoint)

Determines whether the specified character (Unicode code point) is in the Basic Multilingual Plane (BMP).

System.out.println(Character.isBmpCodePoint('a')); // true
System.out.println(Character.isBmpCodePoint('5')); // true
System.out.println(Character.isBmpCodePoint('△')); // true
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isBmpCodePoint(codePoint)); // false

static boolean isDefined (char ch)

Determines if a character is defined in Unicode.

System.out.println(Character.isDefined('a')); // true
System.out.println(Character.isDefined('5')); // true
System.out.println(Character.isDefined('△')); // true

System.out.println(Character.isDefined('\uFFFF')); // false

static boolean isDefined (int codePoint)

Determines if a character (Unicode code point) is defined in Unicode.

Please see also : isDefined(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isDefined(codePoint)); // true
final var codePoint = Character.toCodePoint('\uFFFF', '\uFFFF');
System.out.println(Character.isDefined(codePoint)); // false

static boolean isDigit (char ch)

Determines if the specified character is a digit.

System.out.println(Character.isDigit('0')); // true
System.out.println(Character.isDigit('1')); // true
System.out.println(Character.isDigit('2')); // true

System.out.println(Character.isDigit('a')); // false
System.out.println(Character.isDigit('b')); // false
System.out.println(Character.isDigit('c')); // false

System.out.println(Character.isDigit('٢')); // true
System.out.println(Character.isDigit('٣')); // true

System.out.println(Character.isDigit('Ⅲ')); // false
System.out.println(Character.isDigit('⑫')); // false

static boolean isDigit (int codePoint)

Determines if the specified character (Unicode code point) is a digit.

Please see also : isDigit(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isDigit(codePoint)); // true

static boolean isEmoji (int codePoint)

Determines if the specified character (Unicode code point) is an Emoji.

final var str = "\u0041\u2605\uD83D\uDE0A\u2139";
System.out.println(str); // A★😊ℹ

str.codePoints().forEach(codePoint -> {
    System.out.printf("%c (%#x)%n", codePoint, codePoint);
    System.out.println("  isEmoji = " + Character.isEmoji(codePoint));
    System.out.println("  isEmojiPresentation = "
            + Character.isEmojiPresentation(codePoint));
    System.out.println("  isExtendedPictographic = "
            + Character.isExtendedPictographic(codePoint));
});

// Result
// ↓
//A (0x41)
//  isEmoji = false
//  isEmojiPresentation = false
//  isExtendedPictographic = false
//★ (0x2605)
//  isEmoji = false
//  isEmojiPresentation = false
//  isExtendedPictographic = true
//😊 (0x1f60a)
//  isEmoji = true
//  isEmojiPresentation = true
//  isExtendedPictographic = true
//ℹ (0x2139)
//  isEmoji = true
//  isEmojiPresentation = false
//  isExtendedPictographic = true

static boolean isEmojiComponent (int codePoint)

Determines if the specified character (Unicode code point) is an Emoji Component.

final var str = "\uD83D\uDC4F\uD83C\uDFFB";
System.out.println(str); // 👏🏻

str.codePoints().forEach(codePoint -> {
    System.out.printf("%c (%#x)%n", codePoint, codePoint);
    System.out.println("  isEmojiComponent = "
            + Character.isEmojiComponent(codePoint));
    System.out.println("  isEmojiModifier = "
            + Character.isEmojiModifier(codePoint));
    System.out.println("  isEmojiModifierBase = "
            + Character.isEmojiModifierBase(codePoint));
});

// Result
// ↓
//👏 (0x1f44f)
//  isEmojiComponent = false
//  isEmojiModifier = false
//  isEmojiModifierBase = true
//🏻 (0x1f3fb)
//  isEmojiComponent = true
//  isEmojiModifier = true
//  isEmojiModifierBase = false

static boolean isEmojiModifier (int codePoint)

Determines if the specified character (Unicode code point) is an Emoji Modifier.

final var str = "\uD83D\uDC4F\uD83C\uDFFB";
System.out.println(str); // 👏🏻

str.codePoints().forEach(codePoint -> {
    System.out.printf("%c (%#x)%n", codePoint, codePoint);
    System.out.println("  isEmojiComponent = "
            + Character.isEmojiComponent(codePoint));
    System.out.println("  isEmojiModifier = "
            + Character.isEmojiModifier(codePoint));
    System.out.println("  isEmojiModifierBase = "
            + Character.isEmojiModifierBase(codePoint));
});

// Result
// ↓
//👏 (0x1f44f)
//  isEmojiComponent = false
//  isEmojiModifier = false
//  isEmojiModifierBase = true
//🏻 (0x1f3fb)
//  isEmojiComponent = true
//  isEmojiModifier = true
//  isEmojiModifierBase = false

static boolean isEmojiModifierBase (int codePoint)

Determines if the specified character (Unicode code point) is an Emoji Modifier Base.

final var str = "\uD83D\uDC4F\uD83C\uDFFB";
System.out.println(str); // 👏🏻

str.codePoints().forEach(codePoint -> {
    System.out.printf("%c (%#x)%n", codePoint, codePoint);
    System.out.println("  isEmojiComponent = "
            + Character.isEmojiComponent(codePoint));
    System.out.println("  isEmojiModifier = "
            + Character.isEmojiModifier(codePoint));
    System.out.println("  isEmojiModifierBase = "
            + Character.isEmojiModifierBase(codePoint));
});

// Result
// ↓
//👏 (0x1f44f)
//  isEmojiComponent = false
//  isEmojiModifier = false
//  isEmojiModifierBase = true
//🏻 (0x1f3fb)
//  isEmojiComponent = true
//  isEmojiModifier = true
//  isEmojiModifierBase = false

static boolean isEmojiPresentation (int codePoint)

Determines if the specified character (Unicode code point) has the Emoji Presentation property by default.

final var str = "\u0041\u2605\uD83D\uDE0A\u2139";
System.out.println(str); // A★😊ℹ

str.codePoints().forEach(codePoint -> {
    System.out.printf("%c (%#x)%n", codePoint, codePoint);
    System.out.println("  isEmoji = " + Character.isEmoji(codePoint));
    System.out.println("  isEmojiPresentation = "
            + Character.isEmojiPresentation(codePoint));
    System.out.println("  isExtendedPictographic = "
            + Character.isExtendedPictographic(codePoint));
});

// Result
// ↓
//A (0x41)
//  isEmoji = false
//  isEmojiPresentation = false
//  isExtendedPictographic = false
//★ (0x2605)
//  isEmoji = false
//  isEmojiPresentation = false
//  isExtendedPictographic = true
//😊 (0x1f60a)
//  isEmoji = true
//  isEmojiPresentation = true
//  isExtendedPictographic = true
//ℹ (0x2139)
//  isEmoji = true
//  isEmojiPresentation = false
//  isExtendedPictographic = true

static boolean isExtendedPictographic (int codePoint)

Determines if the specified character (Unicode code point) is an Extended Pictographic.

final var str = "\u0041\u2605\uD83D\uDE0A\u2139";
System.out.println(str); // A★😊ℹ

str.codePoints().forEach(codePoint -> {
    System.out.printf("%c (%#x)%n", codePoint, codePoint);
    System.out.println("  isEmoji = " + Character.isEmoji(codePoint));
    System.out.println("  isEmojiPresentation = "
            + Character.isEmojiPresentation(codePoint));
    System.out.println("  isExtendedPictographic = "
            + Character.isExtendedPictographic(codePoint));
});

// Result
// ↓
//A (0x41)
//  isEmoji = false
//  isEmojiPresentation = false
//  isExtendedPictographic = false
//★ (0x2605)
//  isEmoji = false
//  isEmojiPresentation = false
//  isExtendedPictographic = true
//😊 (0x1f60a)
//  isEmoji = true
//  isEmojiPresentation = true
//  isExtendedPictographic = true
//ℹ (0x2139)
//  isEmoji = true
//  isEmojiPresentation = false
//  isExtendedPictographic = true

static boolean isHighSurrogate (char ch)

Determines if the given char value is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).

final var high = '\uD835';
final var low = '\uDFDD';

System.out.println(Character.isSurrogate(high)); // true
System.out.println(Character.isHighSurrogate(high)); // true
System.out.println(Character.isLowSurrogate(high)); // false

System.out.println(Character.isSurrogate(low)); // true
System.out.println(Character.isHighSurrogate(low)); // false
System.out.println(Character.isLowSurrogate(low)); // true

System.out.println(Character.isSurrogatePair(high, low)); // true
System.out.println(Character.isSurrogatePair(low, high)); // false

final var codePoint = Character.toCodePoint(high, low);
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));
System.out.println(Character.isSurrogate('a')); // false
System.out.println(Character.isHighSurrogate('5')); // false
System.out.println(Character.isLowSurrogate('△')); // false

System.out.println(Character.isSurrogatePair('a', 'b')); // false

static boolean isIdentifierIgnorable (char ch)

Determines if the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

System.out.println(Character.isIdentifierIgnorable('\u0000')); // true
System.out.println(Character.isIdentifierIgnorable('\u000E')); // true

System.out.println(Character.isIdentifierIgnorable('a')); // false
System.out.println(Character.isIdentifierIgnorable('5')); // false
System.out.println(Character.isIdentifierIgnorable('△')); // false

static boolean isIdentifierIgnorable (int codePoint)

Determines if the specified character (Unicode code point) should be regarded as an ignorable character in a Java identifier or a Unicode identifier.

Please see also : isIdentifierIgnorable(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isIdentifierIgnorable(codePoint)); // false

static boolean isIdeographic (int codePoint)

Determines if the specified character (Unicode code point) is a CJKV (Chinese, Japanese, Korean and Vietnamese) ideograph, as defined by the Unicode Standard.

System.out.println(Character.isIdeographic('一')); // true
System.out.println(Character.isIdeographic('空')); // true

System.out.println(Character.isIdeographic('a')); // false
System.out.println(Character.isIdeographic('5')); // false
System.out.println(Character.isIdeographic('△')); // false

static boolean isISOControl (char ch)

Determines if the specified character is an ISO control character.

System.out.println(Character.isISOControl('\u0000')); // true
System.out.println(Character.isISOControl('\u007F')); // true

System.out.println(Character.isISOControl('a')); // false
System.out.println(Character.isISOControl('5')); // false
System.out.println(Character.isISOControl('△')); // false

static boolean isISOControl (int codePoint)

Determines if the referenced character (Unicode code point) is an ISO control character.

Please see also : isISOControl(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isISOControl(codePoint)); // false

static boolean isJavaIdentifierPart (char ch)

Determines if the specified character may be part of a Java identifier as other than the first character.

System.out.println(Character.isJavaIdentifierPart('a')); // true
System.out.println(Character.isJavaIdentifierPart('5')); // true
System.out.println(Character.isJavaIdentifierPart('$')); // true
System.out.println(Character.isJavaIdentifierPart('_')); // true

System.out.println(Character.isJavaIdentifierPart('+')); // false
System.out.println(Character.isJavaIdentifierPart('-')); // false
System.out.println(Character.isJavaIdentifierPart('△')); // false

static boolean isJavaIdentifierPart (int codePoint)

Determines if the character (Unicode code point) may be part of a Java identifier as other than the first character.

Please see also : isJavaIdentifierPart(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isJavaIdentifierPart(codePoint)); // true

static boolean isJavaIdentifierStart (char ch)

Determines if the specified character is permissible as the first character in a Java identifier.

System.out.println(Character.isJavaIdentifierStart('a')); // true
System.out.println(Character.isJavaIdentifierStart('$')); // true
System.out.println(Character.isJavaIdentifierStart('_')); // true

System.out.println(Character.isJavaIdentifierStart('5')); // false
System.out.println(Character.isJavaIdentifierStart('+')); // false
System.out.println(Character.isJavaIdentifierStart('-')); // false
System.out.println(Character.isJavaIdentifierStart('△')); // false

static boolean isJavaIdentifierStart (int codePoint)

Determines if the character (Unicode code point) is permissible as the first character in a Java identifier.

Please see also : isJavaIdentifierStart(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDCBD');
System.out.printf("%c%n", codePoint); // 𝒽

// MATHEMATICAL SCRIPT SMALL H
System.out.println(Character.getName(codePoint));

System.out.println(Character.isJavaIdentifierStart(codePoint)); // true

static boolean isJavaLetter (char ch)

Deprecated. Replaced by isJavaIdentifierStart(char).

Deprecated.

static boolean isJavaLetterOrDigit (char ch)

Deprecated. Replaced by isJavaIdentifierPart(char).

Deprecated.

static boolean isLetter (char ch)

Determines if the specified character is a letter.

System.out.println(Character.isLetter('a')); // true
System.out.println(Character.isLetter('b')); // true
System.out.println(Character.isLetter('X')); // true
System.out.println(Character.isLetter('Y')); // true

System.out.println(Character.isLetter('0')); // false
System.out.println(Character.isLetter('1')); // false
System.out.println(Character.isLetter('2')); // false

System.out.println(Character.isLetter('□')); // false
System.out.println(Character.isLetter('△')); // false

System.out.println(Character.isLetter('Dž')); // true
System.out.println(Character.isLetter('Lj')); // true

static boolean isLetter (int codePoint)

Determines if the specified character (Unicode code point) is a letter.

Please see also : isLetter(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDCBD');
System.out.printf("%c%n", codePoint); // 𝒽

// MATHEMATICAL SCRIPT SMALL H
System.out.println(Character.getName(codePoint));

System.out.println(Character.isLetter(codePoint)); // true

static boolean isLetterOrDigit (char ch)

Determines if the specified character is a letter or digit.

System.out.println(Character.isLetterOrDigit('a')); // true
System.out.println(Character.isLetterOrDigit('b')); // true
System.out.println(Character.isLetterOrDigit('X')); // true
System.out.println(Character.isLetterOrDigit('Y')); // true

System.out.println(Character.isLetterOrDigit('0')); // true
System.out.println(Character.isLetterOrDigit('1')); // true
System.out.println(Character.isLetterOrDigit('2')); // true

System.out.println(Character.isLetterOrDigit('□')); // false
System.out.println(Character.isLetterOrDigit('△')); // false

System.out.println(Character.isLetterOrDigit('Dž')); // true
System.out.println(Character.isLetterOrDigit('Lj')); // true

static boolean isLetterOrDigit (int codePoint)

Determines if the specified character (Unicode code point) is a letter or digit.

Please see also : isLetterOrDigit(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isLetterOrDigit(codePoint)); // true

static boolean isLowerCase (char ch)

Determines if the specified character is a lowercase character.

System.out.println(Character.isLowerCase('a')); // true
System.out.println(Character.isLowerCase('b')); // true
System.out.println(Character.isLowerCase('X')); // false
System.out.println(Character.isLowerCase('Y')); // false

System.out.println(Character.isLowerCase('0')); // false
System.out.println(Character.isLowerCase('1')); // false
System.out.println(Character.isLowerCase('2')); // false

System.out.println(Character.isLowerCase('□')); // false
System.out.println(Character.isLowerCase('△')); // false

System.out.println(Character.isLowerCase('Dž')); // false
System.out.println(Character.isLowerCase('Lj')); // false

static boolean isLowerCase (int codePoint)

Determines if the specified character (Unicode code point) is a lowercase character.

Please see also : isLowerCase(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDCBD');
System.out.printf("%c%n", codePoint); // 𝒽

// MATHEMATICAL SCRIPT SMALL H
System.out.println(Character.getName(codePoint));

System.out.println(Character.isLowerCase(codePoint)); // true

static boolean isLowSurrogate (char ch)

Determines if the given char value is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).

final var high = '\uD835';
final var low = '\uDFDD';

System.out.println(Character.isSurrogate(high)); // true
System.out.println(Character.isHighSurrogate(high)); // true
System.out.println(Character.isLowSurrogate(high)); // false

System.out.println(Character.isSurrogate(low)); // true
System.out.println(Character.isHighSurrogate(low)); // false
System.out.println(Character.isLowSurrogate(low)); // true

System.out.println(Character.isSurrogatePair(high, low)); // true
System.out.println(Character.isSurrogatePair(low, high)); // false

final var codePoint = Character.toCodePoint(high, low);
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));
System.out.println(Character.isSurrogate('a')); // false
System.out.println(Character.isHighSurrogate('5')); // false
System.out.println(Character.isLowSurrogate('△')); // false

System.out.println(Character.isSurrogatePair('a', 'b')); // false

static boolean isMirrored (char ch)

Determines whether the character is mirrored according to the Unicode specification.

System.out.println(Character.isMirrored('(')); // true
System.out.println(Character.isMirrored(')')); // true
System.out.println(Character.isMirrored('[')); // true
System.out.println(Character.isMirrored(']')); // true

System.out.println(Character.isMirrored('a')); // false
System.out.println(Character.isMirrored('b')); // false
System.out.println(Character.isMirrored('c')); // false

static boolean isMirrored (int codePoint)

Determines whether the specified character (Unicode code point) is mirrored according to the Unicode specification.

Please see also : isMirrored(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isMirrored(codePoint)); // false

static boolean isSpace (char ch)

Deprecated. Replaced by isWhitespace(char).

Deprecated.

static boolean isSpaceChar (char ch)

Determines if the specified character is a Unicode space character.

System.out.println(Character.isSpaceChar(' ')); // true
System.out.println(Character.isSpaceChar('\u2028')); // true
System.out.println(Character.isSpaceChar('\u2029')); // true

System.out.println(Character.isSpaceChar('a')); // false
System.out.println(Character.isSpaceChar('5')); // false
System.out.println(Character.isSpaceChar('△')); // false

static boolean isSpaceChar (int codePoint)

Determines if the specified character (Unicode code point) is a Unicode space character.

Please see also : isSpaceChar(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isSpaceChar(codePoint)); // false

static boolean isSupplementaryCodePoint (int codePoint)

Determines whether the specified character (Unicode code point) is in the supplementary character range.

System.out.println(Character.isSupplementaryCodePoint('a')); // false
System.out.println(Character.isSupplementaryCodePoint('5')); // false
System.out.println(Character.isSupplementaryCodePoint('△')); // false
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

System.out.println(Character.isSupplementaryCodePoint(codePoint)); // true

static boolean isSurrogate (char ch)

Determines if the given char value is a Unicode surrogate code unit.

final var high = '\uD835';
final var low = '\uDFDD';

System.out.println(Character.isSurrogate(high)); // true
System.out.println(Character.isHighSurrogate(high)); // true
System.out.println(Character.isLowSurrogate(high)); // false

System.out.println(Character.isSurrogate(low)); // true
System.out.println(Character.isHighSurrogate(low)); // false
System.out.println(Character.isLowSurrogate(low)); // true

System.out.println(Character.isSurrogatePair(high, low)); // true
System.out.println(Character.isSurrogatePair(low, high)); // false

final var codePoint = Character.toCodePoint(high, low);
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));
System.out.println(Character.isSurrogate('a')); // false
System.out.println(Character.isHighSurrogate('5')); // false
System.out.println(Character.isLowSurrogate('△')); // false

System.out.println(Character.isSurrogatePair('a', 'b')); // false

static boolean isSurrogatePair (char high, char low)

Determines whether the specified pair of char values is a valid Unicode surrogate pair.

final var high = '\uD835';
final var low = '\uDFDD';

System.out.println(Character.isSurrogate(high)); // true
System.out.println(Character.isHighSurrogate(high)); // true
System.out.println(Character.isLowSurrogate(high)); // false

System.out.println(Character.isSurrogate(low)); // true
System.out.println(Character.isHighSurrogate(low)); // false
System.out.println(Character.isLowSurrogate(low)); // true

System.out.println(Character.isSurrogatePair(high, low)); // true
System.out.println(Character.isSurrogatePair(low, high)); // false

final var codePoint = Character.toCodePoint(high, low);
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));
System.out.println(Character.isSurrogate('a')); // false
System.out.println(Character.isHighSurrogate('5')); // false
System.out.println(Character.isLowSurrogate('△')); // false

System.out.println(Character.isSurrogatePair('a', 'b')); // false

static boolean isTitleCase (char ch)

Determines if the specified character is a titlecase character.

System.out.println(Character.isTitleCase('Lj')); // true
System.out.println(Character.isTitleCase('Dž')); // true

System.out.println(Character.isTitleCase('a')); // false
System.out.println(Character.isTitleCase('b')); // false
System.out.println(Character.isTitleCase('c')); // false

static boolean isTitleCase (int codePoint)

Determines if the specified character (Unicode code point) is a titlecase character.

Please see also : isTitleCase(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDCBD');
System.out.printf("%c%n", codePoint); // 𝒽

// MATHEMATICAL SCRIPT SMALL H
System.out.println(Character.getName(codePoint));

System.out.println(Character.isTitleCase(codePoint)); // false

static boolean isUnicodeIdentifierPart (char ch)

Determines if the specified character may be part of a Unicode identifier as other than the first character.

System.out.println(Character.isUnicodeIdentifierPart('a')); // true
System.out.println(Character.isUnicodeIdentifierPart('5')); // true
System.out.println(Character.isUnicodeIdentifierPart('_')); // true

System.out.println(Character.isUnicodeIdentifierPart('$')); // false
System.out.println(Character.isUnicodeIdentifierPart('+')); // false
System.out.println(Character.isUnicodeIdentifierPart('-')); // false
System.out.println(Character.isUnicodeIdentifierPart('△')); // false

static boolean isUnicodeIdentifierPart (int codePoint)

Determines if the specified character (Unicode code point) may be part of a Unicode identifier as other than the first character.

Please see also : isUnicodeIdentifierPart(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDCBD');
System.out.printf("%c%n", codePoint); // 𝒽

// MATHEMATICAL SCRIPT SMALL H
System.out.println(Character.getName(codePoint));

System.out.println(Character.isUnicodeIdentifierPart(codePoint)); // true

static boolean isUnicodeIdentifierStart (char ch)

Determines if the specified character is permissible as the first character in a Unicode identifier.

System.out.println(Character.isUnicodeIdentifierStart('a')); // true
System.out.println(Character.isUnicodeIdentifierStart('Ⅱ')); // true

System.out.println(Character.isUnicodeIdentifierStart('5')); // false
System.out.println(Character.isUnicodeIdentifierStart('_')); // false
System.out.println(Character.isUnicodeIdentifierStart('$')); // false
System.out.println(Character.isUnicodeIdentifierStart('+')); // false
System.out.println(Character.isUnicodeIdentifierStart('-')); // false
System.out.println(Character.isUnicodeIdentifierStart('△')); // false

static boolean isUnicodeIdentifierStart (int codePoint)

Determines if the specified character (Unicode code point) is permissible as the first character in a Unicode identifier.

Please see also : isUnicodeIdentifierStart(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDCBD');
System.out.printf("%c%n", codePoint); // 𝒽

// MATHEMATICAL SCRIPT SMALL H
System.out.println(Character.getName(codePoint));

System.out.println(Character.isUnicodeIdentifierStart(codePoint)); // true

static boolean isUpperCase (char ch)

Determines if the specified character is an uppercase character.

System.out.println(Character.isUpperCase('A')); // true
System.out.println(Character.isUpperCase('B')); // true
System.out.println(Character.isUpperCase('x')); // false
System.out.println(Character.isUpperCase('y')); // false

System.out.println(Character.isUpperCase('0')); // false
System.out.println(Character.isUpperCase('1')); // false
System.out.println(Character.isUpperCase('2')); // false

System.out.println(Character.isUpperCase('□')); // false
System.out.println(Character.isUpperCase('△')); // false

System.out.println(Character.isUpperCase('Dž')); // false
System.out.println(Character.isUpperCase('Lj')); // false

static boolean isUpperCase (int codePoint)

Determines if the specified character (Unicode code point) is an uppercase character.

Please see also : isUpperCase(char ch)

final var codePoint = Character.toCodePoint('\uD801', '\uDCB2');
System.out.printf("%c%n", codePoint); // 𐒲

// OSAGE CAPITAL LETTER AIN
System.out.println(Character.getName(codePoint));

System.out.println(Character.isUpperCase(codePoint)); // true

static boolean isValidCodePoint (int codePoint)

Determines whether the specified code point is a valid Unicode code point value.

System.out.println(Character.isValidCodePoint('a')); // true
System.out.println(Character.isValidCodePoint('5')); // true
System.out.println(Character.isValidCodePoint('△')); // true

System.out.println(Character.isValidCodePoint(Character.MIN_CODE_POINT)); // true
System.out.println(Character.isValidCodePoint(Character.MIN_CODE_POINT - 1)); // false

System.out.println(Character.isValidCodePoint(Character.MAX_CODE_POINT)); // true
System.out.println(Character.isValidCodePoint(Character.MAX_CODE_POINT + 1)); // false

static boolean isWhitespace (char ch)

Determines if the specified character is white space according to Java.

System.out.println(Character.isWhitespace(' ')); // true
System.out.println(Character.isWhitespace('\r')); // true
System.out.println(Character.isWhitespace('\n')); // true
System.out.println(Character.isWhitespace('\t')); // true

System.out.println(Character.isWhitespace('a')); // false
System.out.println(Character.isWhitespace('5')); // false
System.out.println(Character.isWhitespace('△')); // false

static boolean isWhitespace (int codePoint)

Determines if the specified character (Unicode code point) is white space according to Java.

Please see also : isWhitespace(char ch)

final var codePoint = Character.toCodePoint('\uD835', '\uDCBD');
System.out.printf("%c%n", codePoint); // 𝒽

// MATHEMATICAL SCRIPT SMALL H
System.out.println(Character.getName(codePoint));

System.out.println(Character.isWhitespace(codePoint)); // false

static char lowSurrogate (int codePoint)

Returns the trailing surrogate (a low surrogate code unit) of the surrogate pair representing the specified supplementary character (Unicode code point) in the UTF-16 encoding.

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var high = Character.highSurrogate(codePoint);
System.out.println(Integer.toHexString(high)); // d835

final var low = Character.lowSurrogate(codePoint);
System.out.println(Integer.toHexString(low)); // dfdd

static int offsetByCodePoints (char[] a, int start, int count, int index, int codePointOffset)

Returns the index within the given char subarray that is offset from the given index by codePointOffset code points.

final var a = "abc".toCharArray();
System.out.println(Arrays.toString(a)); // [a, b, c]

System.out.println(Character.offsetByCodePoints(a, 0, 3, 0, 0)); // 0
System.out.println(Character.offsetByCodePoints(a, 0, 3, 1, 0)); // 1
System.out.println(Character.offsetByCodePoints(a, 0, 3, 2, 0)); // 2
System.out.println(Character.offsetByCodePoints(a, 0, 3, 3, 0)); // 3

System.out.println(Character.offsetByCodePoints(a, 0, 3, 0, 0)); // 0
System.out.println(Character.offsetByCodePoints(a, 0, 3, 0, 1)); // 1
System.out.println(Character.offsetByCodePoints(a, 0, 3, 0, 2)); // 2
System.out.println(Character.offsetByCodePoints(a, 0, 3, 0, 3)); // 3

System.out.println(Character.offsetByCodePoints(a, 0, 3, 0, 0)); // 0
System.out.println(Character.offsetByCodePoints(a, 1, 2, 1, 0)); // 1
System.out.println(Character.offsetByCodePoints(a, 2, 1, 2, 0)); // 2
System.out.println(Character.offsetByCodePoints(a, 3, 0, 3, 0)); // 3
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var seq = Character.toString(codePoint) + "ab";
System.out.println(seq); // 𝟝ab

final char[] a = seq.toCharArray();
System.out.println(Arrays.toString(a)); // [?, ?, a, b]

System.out.println(Character.offsetByCodePoints(a, 0, 4, 0, 0)); // 0
System.out.println(Character.offsetByCodePoints(a, 0, 4, 1, 0)); // 1
System.out.println(Character.offsetByCodePoints(a, 0, 4, 2, 0)); // 2
System.out.println(Character.offsetByCodePoints(a, 0, 4, 3, 0)); // 3
System.out.println(Character.offsetByCodePoints(a, 0, 4, 4, 0)); // 4

System.out.println(Character.offsetByCodePoints(a, 0, 4, 0, 0)); // 0
System.out.println(Character.offsetByCodePoints(a, 0, 4, 0, 1)); // 2
System.out.println(Character.offsetByCodePoints(a, 0, 4, 0, 2)); // 3
System.out.println(Character.offsetByCodePoints(a, 0, 4, 0, 3)); // 4

System.out.println(Character.offsetByCodePoints(a, 1, 3, 1, 0)); // 1
System.out.println(Character.offsetByCodePoints(a, 1, 3, 2, 0)); // 2
System.out.println(Character.offsetByCodePoints(a, 1, 3, 3, 0)); // 3
System.out.println(Character.offsetByCodePoints(a, 1, 3, 4, 0)); // 4

static int offsetByCodePoints (CharSequence seq, int index, int codePointOffset)

Returns the index within the given char sequence that is offset from the given index by codePointOffset code points.

final var seq = "abc";
System.out.println(seq); // abc

System.out.println(Character.offsetByCodePoints(seq, 0, 0)); // 0
System.out.println(Character.offsetByCodePoints(seq, 1, 0)); // 1
System.out.println(Character.offsetByCodePoints(seq, 2, 0)); // 2
System.out.println(Character.offsetByCodePoints(seq, 3, 0)); // 3

System.out.println(Character.offsetByCodePoints(seq, 0, 0)); // 0
System.out.println(Character.offsetByCodePoints(seq, 0, 1)); // 1
System.out.println(Character.offsetByCodePoints(seq, 0, 2)); // 2
System.out.println(Character.offsetByCodePoints(seq, 0, 3)); // 3
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var seq = Character.toString(codePoint) + "ab";
System.out.println(seq); // 𝟝ab

System.out.println(Character.offsetByCodePoints(seq, 0, 0)); // 0
System.out.println(Character.offsetByCodePoints(seq, 1, 0)); // 1
System.out.println(Character.offsetByCodePoints(seq, 2, 0)); // 2
System.out.println(Character.offsetByCodePoints(seq, 3, 0)); // 3
System.out.println(Character.offsetByCodePoints(seq, 4, 0)); // 4

System.out.println(Character.offsetByCodePoints(seq, 0, 0)); // 0
System.out.println(Character.offsetByCodePoints(seq, 0, 1)); // 2
System.out.println(Character.offsetByCodePoints(seq, 0, 2)); // 3
System.out.println(Character.offsetByCodePoints(seq, 0, 3)); // 4

static char reverseBytes (char ch)

Returns the value obtained by reversing the order of the bytes in the specified char value.

final var value = 'a';
final var ret = Character.reverseBytes(value);

System.out.println("-- print --");
System.out.printf("%04x%n", (short) value);
System.out.printf("%04x%n", (short) ret);

// Result
// ↓
//-- print --
//0061
//6100
final var value = '△';
final var ret = Character.reverseBytes(value);

System.out.println("-- print --");
System.out.printf("%04x%n", (short) value);
System.out.printf("%04x%n", (short) ret);

// Result
// ↓
//-- print --
//25b3
//b325

static char[] toChars (int codePoint)

Converts the specified character (Unicode code point) to its UTF-16 representation stored in a char array.

final var ret = Character.toChars('a');
System.out.println(ret.length); // 1
System.out.println(Integer.toHexString(ret[0])); // 61
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var ret = Character.toChars(codePoint);
System.out.println(ret.length); // 2
System.out.println(Integer.toHexString(ret[0])); // d835
System.out.println(Integer.toHexString(ret[1])); // dfdd

static int toChars (int codePoint, char[] dst, int dstIndex)

Converts the specified character (Unicode code point) to its UTF-16 representation.

final var dst = new char[3];
System.out.println(Arrays.toString(dst)); // [ ,  ,  ]

System.out.println(Character.toChars('a', dst, 0)); // 1
System.out.println(Arrays.toString(dst)); // [a,  ,  ]

System.out.println(Character.toChars('b', dst, 1)); // 1
System.out.println(Arrays.toString(dst)); // [a, b,  ]

System.out.println(Character.toChars('c', dst, 2)); // 1
System.out.println(Arrays.toString(dst)); // [a, b, c]
final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var dst = new char[2];
System.out.println(Arrays.toString(dst)); // [ ,  ]

final var ret = Character.toChars(codePoint, dst, 0);
System.out.println(ret); // 2
System.out.println(Integer.toHexString(dst[0])); // d835
System.out.println(Integer.toHexString(dst[1])); // dfdd

static int toCodePoint (char high, char low)

Converts the specified surrogate pair to its supplementary code point value.

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');
System.out.printf("%c%n", codePoint); // 𝟝

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

static char toLowerCase (char ch)

Converts the character argument to lowercase using case mapping information from the UnicodeData file.

System.out.println(Character.toLowerCase('A')); // a
System.out.println(Character.toLowerCase('B')); // b
System.out.println(Character.toLowerCase('C')); // c

System.out.println(Character.toLowerCase('x')); // x
System.out.println(Character.toLowerCase('y')); // y

System.out.println(Character.toLowerCase('0')); // 0
System.out.println(Character.toLowerCase('1')); // 1

System.out.println(Character.toLowerCase('□')); // □
System.out.println(Character.toLowerCase('△')); // △

static int toLowerCase (int codePoint)

Converts the character (Unicode code point) argument to lowercase using case mapping information from the UnicodeData file.

Please see also : toLowerCase(char ch)

final var codePoint = Character.toCodePoint('\uD801', '\uDCB2');
System.out.printf("%c%n", codePoint); // 𐒲

// OSAGE CAPITAL LETTER AIN
System.out.println(Character.getName(codePoint));

final var ret = Character.toLowerCase(codePoint);
System.out.printf("%c%n", ret); // 𐓚

// OSAGE SMALL LETTER AIN
System.out.println(Character.getName(ret));

String toString ()

Returns a String object representing this Character's value.

final var ret1 = Character.valueOf('a').toString();
System.out.println(ret1); // a

final var ret2 = Character.valueOf('5').toString();
System.out.println(ret2); // 5

final var ret3 = Character.valueOf('△').toString();
System.out.println(ret3); // △

static String toString (char c)

Returns a String object representing the specified char.

final var ret1 = Character.toString('a');
System.out.println(ret1); // a

final var ret2 = Character.toString('5');
System.out.println(ret2); // 5

final var ret3 = Character.toString('△');
System.out.println(ret3); // △

static String toString (int codePoint)

Returns a String object representing the specified character (Unicode code point).

final var codePoint = Character.toCodePoint('\uD835', '\uDFDD');

// MATHEMATICAL DOUBLE-STRUCK DIGIT FIVE
System.out.println(Character.getName(codePoint));

final var ret = Character.toString(codePoint);
System.out.println(ret); // 𝟝

static char toTitleCase (char ch)

Converts the character argument to titlecase using case mapping information from the UnicodeData file.

System.out.println(Character.toTitleCase('a')); // A
System.out.println(Character.toTitleCase('b')); // B
System.out.println(Character.toTitleCase('c')); // C

System.out.println(Character.toTitleCase('0')); // 0
System.out.println(Character.toTitleCase('1')); // 1

System.out.println(Character.toTitleCase('□')); // □
System.out.println(Character.toTitleCase('△')); // △

static int toTitleCase (int codePoint)

Converts the character (Unicode code point) argument to titlecase using case mapping information from the UnicodeData file.

Please see also : toTitleCase(char ch)

final var codePoint = Character.toCodePoint('\uD801', '\uDCDA');
System.out.println(Character.toString(codePoint)); // 𐓚

// OSAGE SMALL LETTER AIN
System.out.println(Character.getName(codePoint));

final var ret = Character.toTitleCase(codePoint);
System.out.println(Character.toString(ret)); // 𐒲

// OSAGE SMALL LETTER AIN
System.out.println(Character.getName(codePoint));

static char toUpperCase (char ch)

Converts the character argument to uppercase using case mapping information from the UnicodeData file.

System.out.println(Character.toUpperCase('a')); // A
System.out.println(Character.toUpperCase('b')); // B
System.out.println(Character.toUpperCase('c')); // C

System.out.println(Character.toUpperCase('X')); // X
System.out.println(Character.toUpperCase('Y')); // Y

System.out.println(Character.toUpperCase('0')); // 0
System.out.println(Character.toUpperCase('1')); // 1

System.out.println(Character.toUpperCase('□')); // □
System.out.println(Character.toUpperCase('△')); // △

static int toUpperCase (int codePoint)

Converts the character (Unicode code point) argument to uppercase using case mapping information from the UnicodeData file.

Please see also : toUpperCase(char ch)

final var codePoint = Character.toCodePoint('\uD801', '\uDCDA');
System.out.println(Character.toString(codePoint)); // 𐓚

// OSAGE SMALL LETTER AIN
System.out.println(Character.getName(codePoint));

final var ret = Character.toUpperCase(codePoint);
System.out.println(Character.toString(ret)); // 𐒲

// OSAGE SMALL LETTER AIN
System.out.println(Character.getName(codePoint));

static Character valueOf (char c)

Returns a Character instance representing the specified char value.

final var ret1 = Character.valueOf('a');
System.out.println(ret1); // a

final var ret2 = Character.valueOf('5');
System.out.println(ret2); // 5

final var ret3 = Character.valueOf('△');
System.out.println(ret3); // △

Related posts

To top of page