📄 character.java
字号:
private static final char blockStarts[] = { '\u0000', // Basic Latin '\u0080', // Latin-1 Supplement '\u0100', // Latin Extended-A '\u0180', // Latin Extended-B '\u0250', // IPA Extensions '\u02B0', // Spacing Modifier Letters '\u0300', // Combining Diacritical Marks '\u0370', // Greek '\u0400', // Cyrillic '\u0500', // unassigned '\u0530', // Armenian '\u0590', // Hebrew '\u0600', // Arabic '\u0700', // Syriac '\u0750', // unassigned '\u0780', // Thaana '\u07C0', // unassigned '\u0900', // Devanagari '\u0980', // Bengali '\u0A00', // Gurmukhi '\u0A80', // Gujarati '\u0B00', // Oriya '\u0B80', // Tamil '\u0C00', // Telugu '\u0C80', // Kannada '\u0D00', // Malayalam '\u0D80', // Sinhala '\u0E00', // Thai '\u0E80', // Lao '\u0F00', // Tibetan '\u1000', // Myanmar '\u10A0', // Georgian '\u1100', // Hangul Jamo '\u1200', // Ethiopic '\u1380', // unassigned '\u13A0', // Cherokee '\u1400', // Unified Canadian Aboriginal Syllabics '\u1680', // Ogham '\u16A0', // Runic '\u1700', // unassigned '\u1780', // Khmer '\u1800', // Mongolian '\u18B0', // unassigned '\u1E00', // Latin Extended Additional '\u1F00', // Greek Extended '\u2000', // General Punctuation '\u2070', // Superscripts and Subscripts '\u20A0', // Currency Symbols '\u20D0', // Combining Marks for Symbols '\u2100', // Letterlike Symbols '\u2150', // Number Forms '\u2190', // Arrows '\u2200', // Mathematical Operators '\u2300', // Miscellaneous Technical '\u2400', // Control Pictures '\u2440', // Optical Character Recognition '\u2460', // Enclosed Alphanumerics '\u2500', // Box Drawing '\u2580', // Block Elements '\u25A0', // Geometric Shapes '\u2600', // Miscellaneous Symbols '\u2700', // Dingbats '\u27C0', // unassigned '\u2800', // Braille Patterns '\u2900', // unassigned '\u2E80', // CJK Radicals Supplement '\u2F00', // Kangxi Radicals '\u2FE0', // unassigned '\u2FF0', // Ideographic Description Characters '\u3000', // CJK Symbols and Punctuation '\u3040', // Hiragana '\u30A0', // Katakana '\u3100', // Bopomofo '\u3130', // Hangul Compatibility Jamo '\u3190', // Kanbun '\u31A0', // Bopomofo Extended '\u31C0', // unassigned '\u3200', // Enclosed CJK Letters and Months '\u3300', // CJK Compatibility '\u3400', // CJK Unified Ideographs Extension A '\u4DB6', // unassigned '\u4E00', // CJK Unified Ideographs '\uA000', // Yi Syllables '\uA490', // Yi Radicals '\uA4D0', // unassigned '\uAC00', // Hangul Syllables '\uD7A4', // unassigned '\uD800', // Surrogates '\uE000', // Private Use '\uF900', // CJK Compatibility Ideographs '\uFB00', // Alphabetic Presentation Forms '\uFB50', // Arabic Presentation Forms-A '\uFE00', // unassigned '\uFE20', // Combining Half Marks '\uFE30', // CJK Compatibility Forms '\uFE50', // Small Form Variants '\uFE70', // Arabic Presentation Forms-B '\uFEFF', // Specials '\uFF00', // Halfwidth and Fullwidth Forms '\uFFF0', // Specials '\uFFFE', // non-characters }; private static final UnicodeBlock[] blocks = { BASIC_LATIN, LATIN_1_SUPPLEMENT, LATIN_EXTENDED_A, LATIN_EXTENDED_B, IPA_EXTENSIONS, SPACING_MODIFIER_LETTERS, COMBINING_DIACRITICAL_MARKS, GREEK, CYRILLIC, null, ARMENIAN, HEBREW, ARABIC, SYRIAC, null, THAANA, null, DEVANAGARI, BENGALI, GURMUKHI, GUJARATI, ORIYA, TAMIL, TELUGU, KANNADA, MALAYALAM, SINHALA, THAI, LAO, TIBETAN, MYANMAR, GEORGIAN, HANGUL_JAMO, ETHIOPIC, null, CHEROKEE, UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS, OGHAM, RUNIC, null, KHMER, MONGOLIAN, null, LATIN_EXTENDED_ADDITIONAL, GREEK_EXTENDED, GENERAL_PUNCTUATION, SUPERSCRIPTS_AND_SUBSCRIPTS, CURRENCY_SYMBOLS, COMBINING_MARKS_FOR_SYMBOLS, LETTERLIKE_SYMBOLS, NUMBER_FORMS, ARROWS, MATHEMATICAL_OPERATORS, MISCELLANEOUS_TECHNICAL, CONTROL_PICTURES, OPTICAL_CHARACTER_RECOGNITION, ENCLOSED_ALPHANUMERICS, BOX_DRAWING, BLOCK_ELEMENTS, GEOMETRIC_SHAPES, MISCELLANEOUS_SYMBOLS, DINGBATS, null, BRAILLE_PATTERNS, null, CJK_RADICALS_SUPPLEMENT, KANGXI_RADICALS, null, IDEOGRAPHIC_DESCRIPTION_CHARACTERS, CJK_SYMBOLS_AND_PUNCTUATION, HIRAGANA, KATAKANA, BOPOMOFO, HANGUL_COMPATIBILITY_JAMO, KANBUN, BOPOMOFO_EXTENDED, null, ENCLOSED_CJK_LETTERS_AND_MONTHS, CJK_COMPATIBILITY, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A, null, CJK_UNIFIED_IDEOGRAPHS, YI_SYLLABLES, YI_RADICALS, null, HANGUL_SYLLABLES, null, SURROGATES_AREA, PRIVATE_USE_AREA, CJK_COMPATIBILITY_IDEOGRAPHS, ALPHABETIC_PRESENTATION_FORMS, ARABIC_PRESENTATION_FORMS_A, null, COMBINING_HALF_MARKS, CJK_COMPATIBILITY_FORMS, SMALL_FORM_VARIANTS, ARABIC_PRESENTATION_FORMS_B, SPECIALS, HALFWIDTH_AND_FULLWIDTH_FORMS, SPECIALS, null, }; /** * Returns the object representing the Unicode block containing the * given character, or <code>null</code> if the character is not a * member of a defined block. * * @param c The character in question * @return The <code>UnicodeBlock</code> instance representing the * Unicode block of which this character is a member, or * <code>null</code> if the character is not a member of any * Unicode block */ public static UnicodeBlock of(char c) { int top, bottom, current; bottom = 0; top = blockStarts.length; current = top/2; // invariant: top > current >= bottom && ch >= unicodeBlockStarts[bottom] while (top - bottom > 1) { if (c >= blockStarts[current]) { bottom = current; } else { top = current; } current = (top + bottom) / 2; } return blocks[current]; } } /** * The value of the <code>Character</code>. * * @serial */ private char value; /** use serialVersionUID from JDK 1.0.2 for interoperability */ private static final long serialVersionUID = 3786198910865385080L; /** * Constructs a newly allocated <code>Character</code> object that * represents the specified <code>char</code> value. * * @param value the value to be represented by the * <code>Character</code> object. */ public Character(char value) { this.value = value; } /** * Returns the value of this <code>Character</code> object. * @return the primitive <code>char</code> value represented by * this object. */ public char charValue() { return value; } /** * Returns a hash code for this <code>Character</code>. * @return a hash code value for this object. */ public int hashCode() { return (int)value; } /** * Compares this object against the specified object. * The result is <code>true</code> if and only if the argument is not * <code>null</code> and is a <code>Character</code> object that * represents the same <code>char</code> value as this object. * * @param obj the object to compare with. * @return <code>true</code> if the objects are the same; * <code>false</code> otherwise. */ public boolean equals(Object obj) { if (obj instanceof Character) { return value == ((Character)obj).charValue(); } return false; } /** * Returns a <code>String</code> object representing this * <code>Character</code>'s value. The result is a string of * length 1 whose sole component is the primitive * <code>char</code> value represented by this * <code>Character</code> object. * * @return a string representation of this object. */ public String toString() { char buf[] = {value}; return String.valueOf(buf); } /** * Returns a <code>String</code> object representing the * specified <code>char</code>. The result is a string of length * 1 consisting solely of the specified <code>char</code>. * * @param c the <code>char</code> to be converted * @return the string representation of the specified <code>char</code> * @since 1.4 */ public static String toString(char c) { return String.valueOf(c); } /** * Determines if the specified character is a lowercase character. * <p> * A character is lowercase if its general category type, provided * by <code>Character.getType(ch)</code>, is * <code>LOWERCASE_LETTER</code>. * <p> * The following are examples of lowercase characters: * <p><blockquote><pre> * a b c d e f g h i j k l m n o p q r s t u v w x y z * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6' * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE' * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6' * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF' * </pre></blockquote> * <p> Many other Unicode characters are lowercase too. * <p> * * @param ch the character to be tested. * @return <code>true</code> if the character is lowercase; * <code>false</code> otherwise. * @see java.lang.Character#isLowerCase(char) * @see java.lang.Character#isTitleCase(char) * @see java.lang.Character#toLowerCase(char) * @see java.lang.Character#getType(char) */ public static boolean isLowerCase(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isLowerCase(ch); } else { return CharacterData.isLowerCase(ch); } } /** * Determines if the specified character is an uppercase character. * <p> * A character is uppercase if its general category type, provided by * <code>Character.getType(ch)</code>, is <code>UPPERCASE_LETTER</code>. * <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -