26 package java.lang;
27
28 import java.util.Arrays;
29 import java.util.Map;
30 import java.util.HashMap;
31 import java.util.Locale;
32
33 import jdk.internal.HotSpotIntrinsicCandidate;
34 import jdk.internal.misc.VM;
35
36 /**
37 * The {@code Character} class wraps a value of the primitive
38 * type {@code char} in an object. An object of type
39 * {@code Character} contains a single field whose type is
40 * {@code char}.
41 * <p>
42 * In addition, this class provides several methods for determining
43 * a character's category (lowercase letter, digit, etc.) and for converting
44 * characters from uppercase to lowercase and vice versa.
45 * <p>
46 * Character information is based on the Unicode Standard, version 11.0.0.
47 * <p>
48 * The methods and data of class {@code Character} are defined by
49 * the information in the <i>UnicodeData</i> file that is part of the
50 * Unicode Character Database maintained by the Unicode
51 * Consortium. This file specifies various properties including name
52 * and general category for every defined Unicode code point or
53 * character range.
54 * <p>
55 * The file and its description are available from the Unicode Consortium at:
56 * <ul>
57 * <li><a href="http://www.unicode.org">http://www.unicode.org</a>
58 * </ul>
59 * <p>
60 * The code point, U+32FF, is reserved by the Unicode Consortium
61 * to represent the Japanese square character for the new era that begins
62 * May 2019. Relevant methods in the Character class return the same
63 * properties as for the existing Japanese era characters (e.g., U+337E for
64 * "Meizi"). For the details of the code point, refer to
65 * <a href="http://blog.unicode.org/2018/09/new-japanese-era.html">
66 * http://blog.unicode.org/2018/09/new-japanese-era.html</a>.
67 *
68 * <h3><a id="unicode">Unicode Character Representations</a></h3>
69 *
70 * <p>The {@code char} data type (and therefore the value that a
71 * {@code Character} object encapsulates) are based on the
72 * original Unicode specification, which defined characters as
73 * fixed-width 16-bit entities. The Unicode Standard has since been
74 * changed to allow for characters whose representation requires more
75 * than 16 bits. The range of legal <em>code point</em>s is now
76 * U+0000 to U+10FFFF, known as <em>Unicode scalar value</em>.
77 * (Refer to the <a
78 * href="http://www.unicode.org/reports/tr27/#notation"><i>
79 * definition</i></a> of the U+<i>n</i> notation in the Unicode
80 * Standard.)
81 *
82 * <p><a id="BMP">The set of characters from U+0000 to U+FFFF</a> is
83 * sometimes referred to as the <em>Basic Multilingual Plane (BMP)</em>.
84 * <a id="supplementary">Characters</a> whose code points are greater
85 * than U+FFFF are called <em>supplementary character</em>s. The Java
86 * platform uses the UTF-16 representation in {@code char} arrays and
|
26 package java.lang;
27
28 import java.util.Arrays;
29 import java.util.Map;
30 import java.util.HashMap;
31 import java.util.Locale;
32
33 import jdk.internal.HotSpotIntrinsicCandidate;
34 import jdk.internal.misc.VM;
35
36 /**
37 * The {@code Character} class wraps a value of the primitive
38 * type {@code char} in an object. An object of type
39 * {@code Character} contains a single field whose type is
40 * {@code char}.
41 * <p>
42 * In addition, this class provides several methods for determining
43 * a character's category (lowercase letter, digit, etc.) and for converting
44 * characters from uppercase to lowercase and vice versa.
45 * <p>
46 * Character information is based on <a id="UnicodeVer">the Unicode Standard,
47 * version 11.0.0</a>. Additional currency symbols (and Japanese Era Square
48 * character) defined subsequent to that Unicode version may be present.
49 * <p>
50 * The methods and data of class {@code Character} are defined by
51 * the information in the <i>UnicodeData</i> file that is part of the
52 * Unicode Character Database maintained by the Unicode
53 * Consortium. This file specifies various properties including name
54 * and general category for every defined Unicode code point or
55 * character range.
56 * <p>
57 * The file and its description are available from the Unicode Consortium at:
58 * <ul>
59 * <li><a href="http://www.unicode.org">http://www.unicode.org</a>
60 * </ul>
61 * <p>
62 * The code point, U+32FF, is reserved by the Unicode Consortium
63 * to represent the Japanese square character for the new era that begins
64 * May 2019. Relevant methods in the Character class return the same
65 * properties as for the existing Japanese era characters (e.g., U+337E for
66 * "Meizi"). For the details of the code point, refer to
67 * <a href="http://blog.unicode.org/2018/09/new-japanese-era.html">
68 * http://blog.unicode.org/2018/09/new-japanese-era.html</a>.
69 * <p>
70 * @implSpec The code points in {@link Character.UnicodeBlock#CURRENCY_SYMBOLS
71 * Currency Symbols} {@code UnicodeBlock} that are unassigned as of the
72 * <a href="#UnicodeVer">Unicode version noted above</a>,
73 * may be defined for currency symbols assigned by the Unicode
74 * Consortium from later updates. The definition of additionally assigned
75 * code points is implementation specific.
76 *
77 * <h3><a id="unicode">Unicode Character Representations</a></h3>
78 *
79 * <p>The {@code char} data type (and therefore the value that a
80 * {@code Character} object encapsulates) are based on the
81 * original Unicode specification, which defined characters as
82 * fixed-width 16-bit entities. The Unicode Standard has since been
83 * changed to allow for characters whose representation requires more
84 * than 16 bits. The range of legal <em>code point</em>s is now
85 * U+0000 to U+10FFFF, known as <em>Unicode scalar value</em>.
86 * (Refer to the <a
87 * href="http://www.unicode.org/reports/tr27/#notation"><i>
88 * definition</i></a> of the U+<i>n</i> notation in the Unicode
89 * Standard.)
90 *
91 * <p><a id="BMP">The set of characters from U+0000 to U+FFFF</a> is
92 * sometimes referred to as the <em>Basic Multilingual Plane (BMP)</em>.
93 * <a id="supplementary">Characters</a> whose code points are greater
94 * than U+FFFF are called <em>supplementary character</em>s. The Java
95 * platform uses the UTF-16 representation in {@code char} arrays and
|