Java : Character (文字) - API使用例
Character (Java SE 22 & JDK 22) の使い方まとめです。
ほとんどのメソッドにサンプルコードがあります。
API仕様書のおともにどうぞ。
概要
Characterは、プリミティブ型 char のラッパークラスです。
char は Object ではないので、そのままでは List などのコレクションに追加できません。
そんなときは、 Characterクラスで char をラップすると追加が可能となります。
他には、
- 文字が数字かどうか判定(isDigit)
- 小文字を大文字に変換(toUpperCase)
などなど、文字に関するメソッドがいろいろとそろっています。
関連記事:プリミティブ型 (基本データ型)
// コンパイルエラー
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
フィールド
static final int BYTES
System.out.println(Character.BYTES); // 2
static final byte COMBINING_SPACING_MARK
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
System.out.println(Character.CONNECTOR_PUNCTUATION); // 23
System.out.println(Character.getType('_')); // 23
System.out.println(Character.getType('﹏')); // 23
static final byte CONTROL
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
System.out.println(Character.CURRENCY_SYMBOL); // 26
System.out.println(Character.getType('$')); // 26
System.out.println(Character.getType('¥')); // 26
static final byte DASH_PUNCTUATION
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
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
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
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
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
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
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
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
System.out.println(Character.DIRECTIONALITY_FIRST_STRONG_ISOLATE); // 21
System.out.println(Character.getDirectionality('\u2068')); // 21
static final byte DIRECTIONALITY_LEFT_TO_RIGHT
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
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
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
System.out.println(Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE); // 15
System.out.println(Character.getDirectionality('\u202d')); // 15
static final byte DIRECTIONALITY_NONSPACING_MARK
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
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
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
System.out.println(Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT); // 18
System.out.println(Character.getDirectionality('\u202c')); // 18
static final byte DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE
System.out.println(Character.DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE); // 22
System.out.println(Character.getDirectionality('\u2069')); // 22
static final byte DIRECTIONALITY_RIGHT_TO_LEFT
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
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
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
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
System.out.println(Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE); // 17
System.out.println(Character.getDirectionality('\u202e')); // 17
static final byte DIRECTIONALITY_SEGMENT_SEPARATOR
System.out.println(Character.DIRECTIONALITY_SEGMENT_SEPARATOR); // 11
System.out.println(Character.getDirectionality('\t')); // 11
static final byte DIRECTIONALITY_UNDEFINED
System.out.println(Character.DIRECTIONALITY_UNDEFINED); // -1
System.out.println(Character.getDirectionality('\uFFFF')); // -1
static final byte DIRECTIONALITY_WHITESPACE
System.out.println(Character.DIRECTIONALITY_WHITESPACE); // 12
System.out.println(Character.getDirectionality(' ')); // 12
static final byte ENCLOSING_MARK
System.out.println(Character.ENCLOSING_MARK); // 7
System.out.println(Character.getType('⃣')); // 7
System.out.println(Character.getType('⃠')); // 7
static final byte END_PUNCTUATION
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
System.out.println(Character.FINAL_QUOTE_PUNCTUATION); // 30
System.out.println(Character.getType('”')); // 30
System.out.println(Character.getType('»')); // 30
static final byte FORMAT
System.out.println(Character.FORMAT); // 16
System.out.println(Character.getType('\u00ad')); // 16
static final byte INITIAL_QUOTE_PUNCTUATION
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
System.out.println(Character.LETTER_NUMBER); // 10
System.out.println(Character.getType('Ⅱ')); // 10
System.out.println(Character.getType('ᛯ')); // 10
static final byte LINE_SEPARATOR
System.out.println(Character.LINE_SEPARATOR); // 13
System.out.println(Character.getType('\u2028')); // 13
static final byte LOWERCASE_LETTER
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
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
System.out.printf("%x%n", Character.MAX_CODE_POINT); // 10ffff
static final char MAX_HIGH_SURROGATE
System.out.println(Integer.toHexString(Character.MAX_HIGH_SURROGATE)); // dbff
static final char MAX_LOW_SURROGATE
System.out.println(Integer.toHexString(Character.MAX_LOW_SURROGATE)); // dfff
static final int MAX_RADIX
System.out.println(Character.MAX_RADIX); // 36
static final char MAX_SURROGATE
System.out.println(Integer.toHexString(Character.MAX_SURROGATE)); // dfff
static final char MAX_VALUE
System.out.println(Integer.toHexString(Character.MAX_VALUE)); // ffff
static final int MIN_CODE_POINT
System.out.println(Integer.toHexString(Character.MIN_CODE_POINT)); // 0
static final char MIN_HIGH_SURROGATE
System.out.println(Integer.toHexString(Character.MIN_HIGH_SURROGATE)); // d800
static final char MIN_LOW_SURROGATE
System.out.println(Integer.toHexString(Character.MIN_LOW_SURROGATE)); // dc00
static final int MIN_RADIX
System.out.println(Character.MIN_RADIX); // 2
static final int MIN_SUPPLEMENTARY_CODE_POINT
final var value = Character.MIN_SUPPLEMENTARY_CODE_POINT;
System.out.println(Integer.toHexString(value)); // 10000
static final char MIN_SURROGATE
System.out.println(Integer.toHexString(Character.MIN_SURROGATE)); // d800
static final char MIN_VALUE
System.out.println(Integer.toHexString(Character.MIN_VALUE)); // 0
static final byte MODIFIER_LETTER
System.out.println(Character.MODIFIER_LETTER); // 4
System.out.println(Character.getType('ʰ')); // 4
System.out.println(Character.getType('ʺ')); // 4
static final byte MODIFIER_SYMBOL
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
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
System.out.println(Character.OTHER_LETTER); // 5
System.out.println(Character.getType('ª')); // 5
System.out.println(Character.getType('ƻ')); // 5
static final byte OTHER_NUMBER
System.out.println(Character.OTHER_NUMBER); // 11
System.out.println(Character.getType('¼')); // 11
System.out.println(Character.getType('①')); // 11
static final byte OTHER_PUNCTUATION
System.out.println(Character.OTHER_PUNCTUATION); // 24
System.out.println(Character.getType('!')); // 24
System.out.println(Character.getType('#')); // 24
static final byte OTHER_SYMBOL
System.out.println(Character.OTHER_SYMBOL); // 28
System.out.println(Character.getType('¦')); // 28
System.out.println(Character.getType('҂')); // 28
static final byte PARAGRAPH_SEPARATOR
System.out.println(Character.PARAGRAPH_SEPARATOR); // 14
System.out.println(Character.getType('\u2029')); // 14
static final byte PRIVATE_USE
System.out.println(Character.PRIVATE_USE); // 18
System.out.println(Character.getType('\ue000')); // 18
static final int SIZE
System.out.println(Character.SIZE); // 16
static final byte SPACE_SEPARATOR
System.out.println(Character.SPACE_SEPARATOR); // 12
System.out.println(Character.getType(' ')); // 12
static final byte START_PUNCTUATION
System.out.println(Character.START_PUNCTUATION); // 21
System.out.println(Character.getType('(')); // 21
System.out.println(Character.getType('[')); // 21
static final byte SURROGATE
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
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
System.out.println(Character.TYPE.getName()); // char
System.out.println(Character.TYPE.isPrimitive()); // true
static final byte UNASSIGNED
System.out.println(Character.UNASSIGNED); // 0
System.out.println(Character.getType('\uFFFF')); // 0
static final byte UPPERCASE_LETTER
System.out.println(Character.UPPERCASE_LETTER); // 1
System.out.println(Character.getType('A')); // 1
System.out.println(Character.getType('Ê')); // 1
コンストラクタ
Character (char value)
非推奨です。
メソッド
static int charCount (int codePoint)
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 ()
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)
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);
}
// 結果
// ↓
//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)
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);
}
// 結果
// ↓
//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);
}
// 結果
// ↓
//java.lang.IndexOutOfBoundsException
static int codePointAt (CharSequence seq, int index)
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);
}
// 結果
// ↓
//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)
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);
}
// 結果
// ↓
//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)
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);
}
// 結果
// ↓
//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)
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);
}
// 結果
// ↓
//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)
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)
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)
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)
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)
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 ()
final var ret = Character.valueOf('a').describeConstable();
// Optional[DynamicConstantDesc[ConstantBootstraps::explicitCast(97)char]]
System.out.println(ret);
static int digit (char ch, int 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));
}
// 結果
// ↓
//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)
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)
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)
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));
}
// 結果
// ↓
//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)
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)
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)
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));
});
// 結果
// ↓
//a : LATIN SMALL LETTER A
//b : LATIN SMALL LETTER B
//c : LATIN SMALL LETTER C
static int getNumericValue (char ch)
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)
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));
});
// 結果
// ↓
//Ⅹ : 10
//Ⅺ : 11
//Ⅻ : 12
static int getType (char ch)
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)
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 ()
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)
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)
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)
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)
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)
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)
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)
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)
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)
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));
});
// 結果
// ↓
//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)
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));
});
// 結果
// ↓
//👏 (0x1f44f)
// isEmojiComponent = false
// isEmojiModifier = false
// isEmojiModifierBase = true
//🏻 (0x1f3fb)
// isEmojiComponent = true
// isEmojiModifier = true
// isEmojiModifierBase = false
static boolean isEmojiModifier (int codePoint)
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));
});
// 結果
// ↓
//👏 (0x1f44f)
// isEmojiComponent = false
// isEmojiModifier = false
// isEmojiModifierBase = true
//🏻 (0x1f3fb)
// isEmojiComponent = true
// isEmojiModifier = true
// isEmojiModifierBase = false
static boolean isEmojiModifierBase (int codePoint)
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));
});
// 結果
// ↓
//👏 (0x1f44f)
// isEmojiComponent = false
// isEmojiModifier = false
// isEmojiModifierBase = true
//🏻 (0x1f3fb)
// isEmojiComponent = true
// isEmojiModifier = true
// isEmojiModifierBase = false
static boolean isEmojiPresentation (int codePoint)
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));
});
// 結果
// ↓
//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)
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));
});
// 結果
// ↓
//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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
非推奨です。
static boolean isJavaLetterOrDigit (char ch)
非推奨です。
static boolean isLetter (char ch)
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)
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)
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)
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)
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)
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)
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)
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)
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)
非推奨です。
static boolean isSpaceChar (char ch)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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);
// 結果
// ↓
//-- 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);
// 結果
// ↓
//-- print --
//25b3
//b325
static char[] toChars (int codePoint)
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)
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)
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)
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)
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 ()
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)
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)
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)
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)
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)
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)
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)
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); // △