1 /* 2 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 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 /** 34 * The {@code Character} class wraps a value of the primitive 35 * type {@code char} in an object. An object of type 36 * {@code Character} contains a single field whose type is 37 * {@code char}. 38 * <p> 39 * In addition, this class provides several methods for determining 40 * a character's category (lowercase letter, digit, etc.) and for converting 41 * characters from uppercase to lowercase and vice versa. 42 * <p> 43 * Character information is based on the Unicode Standard, version 6.2.0. 44 * <p> 45 * The methods and data of class {@code Character} are defined by 46 * the information in the <i>UnicodeData</i> file that is part of the 47 * Unicode Character Database maintained by the Unicode 48 * Consortium. This file specifies various properties including name 49 * and general category for every defined Unicode code point or 50 * character range. 51 * <p> 52 * The file and its description are available from the Unicode Consortium at: 53 * <ul> 54 * <li><a href="http://www.unicode.org">http://www.unicode.org</a> 55 * </ul> 56 * 57 * <h3><a name="unicode">Unicode Character Representations</a></h3> 58 * 59 * <p>The {@code char} data type (and therefore the value that a 60 * {@code Character} object encapsulates) are based on the 61 * original Unicode specification, which defined characters as 62 * fixed-width 16-bit entities. The Unicode Standard has since been 63 * changed to allow for characters whose representation requires more 64 * than 16 bits. The range of legal <em>code point</em>s is now 65 * U+0000 to U+10FFFF, known as <em>Unicode scalar value</em>. 66 * (Refer to the <a 67 * href="http://www.unicode.org/reports/tr27/#notation"><i> 68 * definition</i></a> of the U+<i>n</i> notation in the Unicode 69 * Standard.) 70 * 71 * <p><a name="BMP">The set of characters from U+0000 to U+FFFF</a> is 72 * sometimes referred to as the <em>Basic Multilingual Plane (BMP)</em>. 73 * <a name="supplementary">Characters</a> whose code points are greater 74 * than U+FFFF are called <em>supplementary character</em>s. The Java 75 * platform uses the UTF-16 representation in {@code char} arrays and 76 * in the {@code String} and {@code StringBuffer} classes. In 77 * this representation, supplementary characters are represented as a pair 78 * of {@code char} values, the first from the <em>high-surrogates</em> 79 * range, (\uD800-\uDBFF), the second from the 80 * <em>low-surrogates</em> range (\uDC00-\uDFFF). 81 * 82 * <p>A {@code char} value, therefore, represents Basic 83 * Multilingual Plane (BMP) code points, including the surrogate 84 * code points, or code units of the UTF-16 encoding. An 85 * {@code int} value represents all Unicode code points, 86 * including supplementary code points. The lower (least significant) 87 * 21 bits of {@code int} are used to represent Unicode code 88 * points and the upper (most significant) 11 bits must be zero. 89 * Unless otherwise specified, the behavior with respect to 90 * supplementary characters and surrogate {@code char} values is 91 * as follows: 92 * 93 * <ul> 94 * <li>The methods that only accept a {@code char} value cannot support 95 * supplementary characters. They treat {@code char} values from the 96 * surrogate ranges as undefined characters. For example, 97 * {@code Character.isLetter('\u005CuD840')} returns {@code false}, even though 98 * this specific value if followed by any low-surrogate value in a string 99 * would represent a letter. 100 * 101 * <li>The methods that accept an {@code int} value support all 102 * Unicode characters, including supplementary characters. For 103 * example, {@code Character.isLetter(0x2F81A)} returns 104 * {@code true} because the code point value represents a letter 105 * (a CJK ideograph). 106 * </ul> 107 * 108 * <p>In the Java SE API documentation, <em>Unicode code point</em> is 109 * used for character values in the range between U+0000 and U+10FFFF, 110 * and <em>Unicode code unit</em> is used for 16-bit 111 * {@code char} values that are code units of the <em>UTF-16</em> 112 * encoding. For more information on Unicode terminology, refer to the 113 * <a href="http://www.unicode.org/glossary/">Unicode Glossary</a>. 114 * 115 * @author Lee Boynton 116 * @author Guy Steele 117 * @author Akira Tanaka 118 * @author Martin Buchholz 119 * @author Ulf Zibis 120 * @since 1.0 121 */ 122 public final 123 class Character implements java.io.Serializable, Comparable<Character> { 124 /** 125 * The minimum radix available for conversion to and from strings. 126 * The constant value of this field is the smallest value permitted 127 * for the radix argument in radix-conversion methods such as the 128 * {@code digit} method, the {@code forDigit} method, and the 129 * {@code toString} method of class {@code Integer}. 130 * 131 * @see Character#digit(char, int) 132 * @see Character#forDigit(int, int) 133 * @see Integer#toString(int, int) 134 * @see Integer#valueOf(String) 135 */ 136 public static final int MIN_RADIX = 2; 137 138 /** 139 * The maximum radix available for conversion to and from strings. 140 * The constant value of this field is the largest value permitted 141 * for the radix argument in radix-conversion methods such as the 142 * {@code digit} method, the {@code forDigit} method, and the 143 * {@code toString} method of class {@code Integer}. 144 * 145 * @see Character#digit(char, int) 146 * @see Character#forDigit(int, int) 147 * @see Integer#toString(int, int) 148 * @see Integer#valueOf(String) 149 */ 150 public static final int MAX_RADIX = 36; 151 152 /** 153 * The constant value of this field is the smallest value of type 154 * {@code char}, {@code '\u005Cu0000'}. 155 * 156 * @since 1.0.2 157 */ 158 public static final char MIN_VALUE = '\u0000'; 159 160 /** 161 * The constant value of this field is the largest value of type 162 * {@code char}, {@code '\u005CuFFFF'}. 163 * 164 * @since 1.0.2 165 */ 166 public static final char MAX_VALUE = '\uFFFF'; 167 168 /** 169 * The {@code Class} instance representing the primitive type 170 * {@code char}. 171 * 172 * @since 1.1 173 */ 174 @SuppressWarnings("unchecked") 175 public static final Class<Character> TYPE = (Class<Character>) Class.getPrimitiveClass("char"); 176 177 /* 178 * Normative general types 179 */ 180 181 /* 182 * General character types 183 */ 184 185 /** 186 * General category "Cn" in the Unicode specification. 187 * @since 1.1 188 */ 189 public static final byte UNASSIGNED = 0; 190 191 /** 192 * General category "Lu" in the Unicode specification. 193 * @since 1.1 194 */ 195 public static final byte UPPERCASE_LETTER = 1; 196 197 /** 198 * General category "Ll" in the Unicode specification. 199 * @since 1.1 200 */ 201 public static final byte LOWERCASE_LETTER = 2; 202 203 /** 204 * General category "Lt" in the Unicode specification. 205 * @since 1.1 206 */ 207 public static final byte TITLECASE_LETTER = 3; 208 209 /** 210 * General category "Lm" in the Unicode specification. 211 * @since 1.1 212 */ 213 public static final byte MODIFIER_LETTER = 4; 214 215 /** 216 * General category "Lo" in the Unicode specification. 217 * @since 1.1 218 */ 219 public static final byte OTHER_LETTER = 5; 220 221 /** 222 * General category "Mn" in the Unicode specification. 223 * @since 1.1 224 */ 225 public static final byte NON_SPACING_MARK = 6; 226 227 /** 228 * General category "Me" in the Unicode specification. 229 * @since 1.1 230 */ 231 public static final byte ENCLOSING_MARK = 7; 232 233 /** 234 * General category "Mc" in the Unicode specification. 235 * @since 1.1 236 */ 237 public static final byte COMBINING_SPACING_MARK = 8; 238 239 /** 240 * General category "Nd" in the Unicode specification. 241 * @since 1.1 242 */ 243 public static final byte DECIMAL_DIGIT_NUMBER = 9; 244 245 /** 246 * General category "Nl" in the Unicode specification. 247 * @since 1.1 248 */ 249 public static final byte LETTER_NUMBER = 10; 250 251 /** 252 * General category "No" in the Unicode specification. 253 * @since 1.1 254 */ 255 public static final byte OTHER_NUMBER = 11; 256 257 /** 258 * General category "Zs" in the Unicode specification. 259 * @since 1.1 260 */ 261 public static final byte SPACE_SEPARATOR = 12; 262 263 /** 264 * General category "Zl" in the Unicode specification. 265 * @since 1.1 266 */ 267 public static final byte LINE_SEPARATOR = 13; 268 269 /** 270 * General category "Zp" in the Unicode specification. 271 * @since 1.1 272 */ 273 public static final byte PARAGRAPH_SEPARATOR = 14; 274 275 /** 276 * General category "Cc" in the Unicode specification. 277 * @since 1.1 278 */ 279 public static final byte CONTROL = 15; 280 281 /** 282 * General category "Cf" in the Unicode specification. 283 * @since 1.1 284 */ 285 public static final byte FORMAT = 16; 286 287 /** 288 * General category "Co" in the Unicode specification. 289 * @since 1.1 290 */ 291 public static final byte PRIVATE_USE = 18; 292 293 /** 294 * General category "Cs" in the Unicode specification. 295 * @since 1.1 296 */ 297 public static final byte SURROGATE = 19; 298 299 /** 300 * General category "Pd" in the Unicode specification. 301 * @since 1.1 302 */ 303 public static final byte DASH_PUNCTUATION = 20; 304 305 /** 306 * General category "Ps" in the Unicode specification. 307 * @since 1.1 308 */ 309 public static final byte START_PUNCTUATION = 21; 310 311 /** 312 * General category "Pe" in the Unicode specification. 313 * @since 1.1 314 */ 315 public static final byte END_PUNCTUATION = 22; 316 317 /** 318 * General category "Pc" in the Unicode specification. 319 * @since 1.1 320 */ 321 public static final byte CONNECTOR_PUNCTUATION = 23; 322 323 /** 324 * General category "Po" in the Unicode specification. 325 * @since 1.1 326 */ 327 public static final byte OTHER_PUNCTUATION = 24; 328 329 /** 330 * General category "Sm" in the Unicode specification. 331 * @since 1.1 332 */ 333 public static final byte MATH_SYMBOL = 25; 334 335 /** 336 * General category "Sc" in the Unicode specification. 337 * @since 1.1 338 */ 339 public static final byte CURRENCY_SYMBOL = 26; 340 341 /** 342 * General category "Sk" in the Unicode specification. 343 * @since 1.1 344 */ 345 public static final byte MODIFIER_SYMBOL = 27; 346 347 /** 348 * General category "So" in the Unicode specification. 349 * @since 1.1 350 */ 351 public static final byte OTHER_SYMBOL = 28; 352 353 /** 354 * General category "Pi" in the Unicode specification. 355 * @since 1.4 356 */ 357 public static final byte INITIAL_QUOTE_PUNCTUATION = 29; 358 359 /** 360 * General category "Pf" in the Unicode specification. 361 * @since 1.4 362 */ 363 public static final byte FINAL_QUOTE_PUNCTUATION = 30; 364 365 /** 366 * Error flag. Use int (code point) to avoid confusion with U+FFFF. 367 */ 368 static final int ERROR = 0xFFFFFFFF; 369 370 371 /** 372 * Undefined bidirectional character type. Undefined {@code char} 373 * values have undefined directionality in the Unicode specification. 374 * @since 1.4 375 */ 376 public static final byte DIRECTIONALITY_UNDEFINED = -1; 377 378 /** 379 * Strong bidirectional character type "L" in the Unicode specification. 380 * @since 1.4 381 */ 382 public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = 0; 383 384 /** 385 * Strong bidirectional character type "R" in the Unicode specification. 386 * @since 1.4 387 */ 388 public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = 1; 389 390 /** 391 * Strong bidirectional character type "AL" in the Unicode specification. 392 * @since 1.4 393 */ 394 public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2; 395 396 /** 397 * Weak bidirectional character type "EN" in the Unicode specification. 398 * @since 1.4 399 */ 400 public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = 3; 401 402 /** 403 * Weak bidirectional character type "ES" in the Unicode specification. 404 * @since 1.4 405 */ 406 public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4; 407 408 /** 409 * Weak bidirectional character type "ET" in the Unicode specification. 410 * @since 1.4 411 */ 412 public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5; 413 414 /** 415 * Weak bidirectional character type "AN" in the Unicode specification. 416 * @since 1.4 417 */ 418 public static final byte DIRECTIONALITY_ARABIC_NUMBER = 6; 419 420 /** 421 * Weak bidirectional character type "CS" in the Unicode specification. 422 * @since 1.4 423 */ 424 public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7; 425 426 /** 427 * Weak bidirectional character type "NSM" in the Unicode specification. 428 * @since 1.4 429 */ 430 public static final byte DIRECTIONALITY_NONSPACING_MARK = 8; 431 432 /** 433 * Weak bidirectional character type "BN" in the Unicode specification. 434 * @since 1.4 435 */ 436 public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = 9; 437 438 /** 439 * Neutral bidirectional character type "B" in the Unicode specification. 440 * @since 1.4 441 */ 442 public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10; 443 444 /** 445 * Neutral bidirectional character type "S" in the Unicode specification. 446 * @since 1.4 447 */ 448 public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = 11; 449 450 /** 451 * Neutral bidirectional character type "WS" in the Unicode specification. 452 * @since 1.4 453 */ 454 public static final byte DIRECTIONALITY_WHITESPACE = 12; 455 456 /** 457 * Neutral bidirectional character type "ON" in the Unicode specification. 458 * @since 1.4 459 */ 460 public static final byte DIRECTIONALITY_OTHER_NEUTRALS = 13; 461 462 /** 463 * Strong bidirectional character type "LRE" in the Unicode specification. 464 * @since 1.4 465 */ 466 public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14; 467 468 /** 469 * Strong bidirectional character type "LRO" in the Unicode specification. 470 * @since 1.4 471 */ 472 public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15; 473 474 /** 475 * Strong bidirectional character type "RLE" in the Unicode specification. 476 * @since 1.4 477 */ 478 public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16; 479 480 /** 481 * Strong bidirectional character type "RLO" in the Unicode specification. 482 * @since 1.4 483 */ 484 public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17; 485 486 /** 487 * Weak bidirectional character type "PDF" in the Unicode specification. 488 * @since 1.4 489 */ 490 public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18; 491 492 /** 493 * The minimum value of a 494 * <a href="http://www.unicode.org/glossary/#high_surrogate_code_unit"> 495 * Unicode high-surrogate code unit</a> 496 * in the UTF-16 encoding, constant {@code '\u005CuD800'}. 497 * A high-surrogate is also known as a <i>leading-surrogate</i>. 498 * 499 * @since 1.5 500 */ 501 public static final char MIN_HIGH_SURROGATE = '\uD800'; 502 503 /** 504 * The maximum value of a 505 * <a href="http://www.unicode.org/glossary/#high_surrogate_code_unit"> 506 * Unicode high-surrogate code unit</a> 507 * in the UTF-16 encoding, constant {@code '\u005CuDBFF'}. 508 * A high-surrogate is also known as a <i>leading-surrogate</i>. 509 * 510 * @since 1.5 511 */ 512 public static final char MAX_HIGH_SURROGATE = '\uDBFF'; 513 514 /** 515 * The minimum value of a 516 * <a href="http://www.unicode.org/glossary/#low_surrogate_code_unit"> 517 * Unicode low-surrogate code unit</a> 518 * in the UTF-16 encoding, constant {@code '\u005CuDC00'}. 519 * A low-surrogate is also known as a <i>trailing-surrogate</i>. 520 * 521 * @since 1.5 522 */ 523 public static final char MIN_LOW_SURROGATE = '\uDC00'; 524 525 /** 526 * The maximum value of a 527 * <a href="http://www.unicode.org/glossary/#low_surrogate_code_unit"> 528 * Unicode low-surrogate code unit</a> 529 * in the UTF-16 encoding, constant {@code '\u005CuDFFF'}. 530 * A low-surrogate is also known as a <i>trailing-surrogate</i>. 531 * 532 * @since 1.5 533 */ 534 public static final char MAX_LOW_SURROGATE = '\uDFFF'; 535 536 /** 537 * The minimum value of a Unicode surrogate code unit in the 538 * UTF-16 encoding, constant {@code '\u005CuD800'}. 539 * 540 * @since 1.5 541 */ 542 public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE; 543 544 /** 545 * The maximum value of a Unicode surrogate code unit in the 546 * UTF-16 encoding, constant {@code '\u005CuDFFF'}. 547 * 548 * @since 1.5 549 */ 550 public static final char MAX_SURROGATE = MAX_LOW_SURROGATE; 551 552 /** 553 * The minimum value of a 554 * <a href="http://www.unicode.org/glossary/#supplementary_code_point"> 555 * Unicode supplementary code point</a>, constant {@code U+10000}. 556 * 557 * @since 1.5 558 */ 559 public static final int MIN_SUPPLEMENTARY_CODE_POINT = 0x010000; 560 561 /** 562 * The minimum value of a 563 * <a href="http://www.unicode.org/glossary/#code_point"> 564 * Unicode code point</a>, constant {@code U+0000}. 565 * 566 * @since 1.5 567 */ 568 public static final int MIN_CODE_POINT = 0x000000; 569 570 /** 571 * The maximum value of a 572 * <a href="http://www.unicode.org/glossary/#code_point"> 573 * Unicode code point</a>, constant {@code U+10FFFF}. 574 * 575 * @since 1.5 576 */ 577 public static final int MAX_CODE_POINT = 0X10FFFF; 578 579 580 /** 581 * Instances of this class represent particular subsets of the Unicode 582 * character set. The only family of subsets defined in the 583 * {@code Character} class is {@link Character.UnicodeBlock}. 584 * Other portions of the Java API may define other subsets for their 585 * own purposes. 586 * 587 * @since 1.2 588 */ 589 public static class Subset { 590 591 private String name; 592 593 /** 594 * Constructs a new {@code Subset} instance. 595 * 596 * @param name The name of this subset 597 * @exception NullPointerException if name is {@code null} 598 */ 599 protected Subset(String name) { 600 if (name == null) { 601 throw new NullPointerException("name"); 602 } 603 this.name = name; 604 } 605 606 /** 607 * Compares two {@code Subset} objects for equality. 608 * This method returns {@code true} if and only if 609 * {@code this} and the argument refer to the same 610 * object; since this method is {@code final}, this 611 * guarantee holds for all subclasses. 612 */ 613 public final boolean equals(Object obj) { 614 return (this == obj); 615 } 616 617 /** 618 * Returns the standard hash code as defined by the 619 * {@link Object#hashCode} method. This method 620 * is {@code final} in order to ensure that the 621 * {@code equals} and {@code hashCode} methods will 622 * be consistent in all subclasses. 623 */ 624 public final int hashCode() { 625 return super.hashCode(); 626 } 627 628 /** 629 * Returns the name of this subset. 630 */ 631 public final String toString() { 632 return name; 633 } 634 } 635 636 // See http://www.unicode.org/Public/UNIDATA/Blocks.txt 637 // for the latest specification of Unicode Blocks. 638 639 /** 640 * A family of character subsets representing the character blocks in the 641 * Unicode specification. Character blocks generally define characters 642 * used for a specific script or purpose. A character is contained by 643 * at most one Unicode block. 644 * 645 * @since 1.2 646 */ 647 public static final class UnicodeBlock extends Subset { 648 /** 649 * 510 - the expected number of enteties 650 * 0.75 - the default load factor of HashMap 651 */ 652 private static final int INITIAL_CAPACITY = 653 (int)(510 / 0.75f + 1.0f); 654 private static Map<String, UnicodeBlock> map = 655 new HashMap<>(INITIAL_CAPACITY); 656 657 /** 658 * Creates a UnicodeBlock with the given identifier name. 659 * This name must be the same as the block identifier. 660 */ 661 private UnicodeBlock(String idName) { 662 super(idName); 663 map.put(idName, this); 664 } 665 666 /** 667 * Creates a UnicodeBlock with the given identifier name and 668 * alias name. 669 */ 670 private UnicodeBlock(String idName, String alias) { 671 this(idName); 672 map.put(alias, this); 673 } 674 675 /** 676 * Creates a UnicodeBlock with the given identifier name and 677 * alias names. 678 */ 679 private UnicodeBlock(String idName, String... aliases) { 680 this(idName); 681 for (String alias : aliases) 682 map.put(alias, this); 683 } 684 685 /** 686 * Constant for the "Basic Latin" Unicode character block. 687 * @since 1.2 688 */ 689 public static final UnicodeBlock BASIC_LATIN = 690 new UnicodeBlock("BASIC_LATIN", 691 "BASIC LATIN", 692 "BASICLATIN"); 693 694 /** 695 * Constant for the "Latin-1 Supplement" Unicode character block. 696 * @since 1.2 697 */ 698 public static final UnicodeBlock LATIN_1_SUPPLEMENT = 699 new UnicodeBlock("LATIN_1_SUPPLEMENT", 700 "LATIN-1 SUPPLEMENT", 701 "LATIN-1SUPPLEMENT"); 702 703 /** 704 * Constant for the "Latin Extended-A" Unicode character block. 705 * @since 1.2 706 */ 707 public static final UnicodeBlock LATIN_EXTENDED_A = 708 new UnicodeBlock("LATIN_EXTENDED_A", 709 "LATIN EXTENDED-A", 710 "LATINEXTENDED-A"); 711 712 /** 713 * Constant for the "Latin Extended-B" Unicode character block. 714 * @since 1.2 715 */ 716 public static final UnicodeBlock LATIN_EXTENDED_B = 717 new UnicodeBlock("LATIN_EXTENDED_B", 718 "LATIN EXTENDED-B", 719 "LATINEXTENDED-B"); 720 721 /** 722 * Constant for the "IPA Extensions" Unicode character block. 723 * @since 1.2 724 */ 725 public static final UnicodeBlock IPA_EXTENSIONS = 726 new UnicodeBlock("IPA_EXTENSIONS", 727 "IPA EXTENSIONS", 728 "IPAEXTENSIONS"); 729 730 /** 731 * Constant for the "Spacing Modifier Letters" Unicode character block. 732 * @since 1.2 733 */ 734 public static final UnicodeBlock SPACING_MODIFIER_LETTERS = 735 new UnicodeBlock("SPACING_MODIFIER_LETTERS", 736 "SPACING MODIFIER LETTERS", 737 "SPACINGMODIFIERLETTERS"); 738 739 /** 740 * Constant for the "Combining Diacritical Marks" Unicode character block. 741 * @since 1.2 742 */ 743 public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS = 744 new UnicodeBlock("COMBINING_DIACRITICAL_MARKS", 745 "COMBINING DIACRITICAL MARKS", 746 "COMBININGDIACRITICALMARKS"); 747 748 /** 749 * Constant for the "Greek and Coptic" Unicode character block. 750 * <p> 751 * This block was previously known as the "Greek" block. 752 * 753 * @since 1.2 754 */ 755 public static final UnicodeBlock GREEK = 756 new UnicodeBlock("GREEK", 757 "GREEK AND COPTIC", 758 "GREEKANDCOPTIC"); 759 760 /** 761 * Constant for the "Cyrillic" Unicode character block. 762 * @since 1.2 763 */ 764 public static final UnicodeBlock CYRILLIC = 765 new UnicodeBlock("CYRILLIC"); 766 767 /** 768 * Constant for the "Armenian" Unicode character block. 769 * @since 1.2 770 */ 771 public static final UnicodeBlock ARMENIAN = 772 new UnicodeBlock("ARMENIAN"); 773 774 /** 775 * Constant for the "Hebrew" Unicode character block. 776 * @since 1.2 777 */ 778 public static final UnicodeBlock HEBREW = 779 new UnicodeBlock("HEBREW"); 780 781 /** 782 * Constant for the "Arabic" Unicode character block. 783 * @since 1.2 784 */ 785 public static final UnicodeBlock ARABIC = 786 new UnicodeBlock("ARABIC"); 787 788 /** 789 * Constant for the "Devanagari" Unicode character block. 790 * @since 1.2 791 */ 792 public static final UnicodeBlock DEVANAGARI = 793 new UnicodeBlock("DEVANAGARI"); 794 795 /** 796 * Constant for the "Bengali" Unicode character block. 797 * @since 1.2 798 */ 799 public static final UnicodeBlock BENGALI = 800 new UnicodeBlock("BENGALI"); 801 802 /** 803 * Constant for the "Gurmukhi" Unicode character block. 804 * @since 1.2 805 */ 806 public static final UnicodeBlock GURMUKHI = 807 new UnicodeBlock("GURMUKHI"); 808 809 /** 810 * Constant for the "Gujarati" Unicode character block. 811 * @since 1.2 812 */ 813 public static final UnicodeBlock GUJARATI = 814 new UnicodeBlock("GUJARATI"); 815 816 /** 817 * Constant for the "Oriya" Unicode character block. 818 * @since 1.2 819 */ 820 public static final UnicodeBlock ORIYA = 821 new UnicodeBlock("ORIYA"); 822 823 /** 824 * Constant for the "Tamil" Unicode character block. 825 * @since 1.2 826 */ 827 public static final UnicodeBlock TAMIL = 828 new UnicodeBlock("TAMIL"); 829 830 /** 831 * Constant for the "Telugu" Unicode character block. 832 * @since 1.2 833 */ 834 public static final UnicodeBlock TELUGU = 835 new UnicodeBlock("TELUGU"); 836 837 /** 838 * Constant for the "Kannada" Unicode character block. 839 * @since 1.2 840 */ 841 public static final UnicodeBlock KANNADA = 842 new UnicodeBlock("KANNADA"); 843 844 /** 845 * Constant for the "Malayalam" Unicode character block. 846 * @since 1.2 847 */ 848 public static final UnicodeBlock MALAYALAM = 849 new UnicodeBlock("MALAYALAM"); 850 851 /** 852 * Constant for the "Thai" Unicode character block. 853 * @since 1.2 854 */ 855 public static final UnicodeBlock THAI = 856 new UnicodeBlock("THAI"); 857 858 /** 859 * Constant for the "Lao" Unicode character block. 860 * @since 1.2 861 */ 862 public static final UnicodeBlock LAO = 863 new UnicodeBlock("LAO"); 864 865 /** 866 * Constant for the "Tibetan" Unicode character block. 867 * @since 1.2 868 */ 869 public static final UnicodeBlock TIBETAN = 870 new UnicodeBlock("TIBETAN"); 871 872 /** 873 * Constant for the "Georgian" Unicode character block. 874 * @since 1.2 875 */ 876 public static final UnicodeBlock GEORGIAN = 877 new UnicodeBlock("GEORGIAN"); 878 879 /** 880 * Constant for the "Hangul Jamo" Unicode character block. 881 * @since 1.2 882 */ 883 public static final UnicodeBlock HANGUL_JAMO = 884 new UnicodeBlock("HANGUL_JAMO", 885 "HANGUL JAMO", 886 "HANGULJAMO"); 887 888 /** 889 * Constant for the "Latin Extended Additional" Unicode character block. 890 * @since 1.2 891 */ 892 public static final UnicodeBlock LATIN_EXTENDED_ADDITIONAL = 893 new UnicodeBlock("LATIN_EXTENDED_ADDITIONAL", 894 "LATIN EXTENDED ADDITIONAL", 895 "LATINEXTENDEDADDITIONAL"); 896 897 /** 898 * Constant for the "Greek Extended" Unicode character block. 899 * @since 1.2 900 */ 901 public static final UnicodeBlock GREEK_EXTENDED = 902 new UnicodeBlock("GREEK_EXTENDED", 903 "GREEK EXTENDED", 904 "GREEKEXTENDED"); 905 906 /** 907 * Constant for the "General Punctuation" Unicode character block. 908 * @since 1.2 909 */ 910 public static final UnicodeBlock GENERAL_PUNCTUATION = 911 new UnicodeBlock("GENERAL_PUNCTUATION", 912 "GENERAL PUNCTUATION", 913 "GENERALPUNCTUATION"); 914 915 /** 916 * Constant for the "Superscripts and Subscripts" Unicode character 917 * block. 918 * @since 1.2 919 */ 920 public static final UnicodeBlock SUPERSCRIPTS_AND_SUBSCRIPTS = 921 new UnicodeBlock("SUPERSCRIPTS_AND_SUBSCRIPTS", 922 "SUPERSCRIPTS AND SUBSCRIPTS", 923 "SUPERSCRIPTSANDSUBSCRIPTS"); 924 925 /** 926 * Constant for the "Currency Symbols" Unicode character block. 927 * @since 1.2 928 */ 929 public static final UnicodeBlock CURRENCY_SYMBOLS = 930 new UnicodeBlock("CURRENCY_SYMBOLS", 931 "CURRENCY SYMBOLS", 932 "CURRENCYSYMBOLS"); 933 934 /** 935 * Constant for the "Combining Diacritical Marks for Symbols" Unicode 936 * character block. 937 * <p> 938 * This block was previously known as "Combining Marks for Symbols". 939 * @since 1.2 940 */ 941 public static final UnicodeBlock COMBINING_MARKS_FOR_SYMBOLS = 942 new UnicodeBlock("COMBINING_MARKS_FOR_SYMBOLS", 943 "COMBINING DIACRITICAL MARKS FOR SYMBOLS", 944 "COMBININGDIACRITICALMARKSFORSYMBOLS", 945 "COMBINING MARKS FOR SYMBOLS", 946 "COMBININGMARKSFORSYMBOLS"); 947 948 /** 949 * Constant for the "Letterlike Symbols" Unicode character block. 950 * @since 1.2 951 */ 952 public static final UnicodeBlock LETTERLIKE_SYMBOLS = 953 new UnicodeBlock("LETTERLIKE_SYMBOLS", 954 "LETTERLIKE SYMBOLS", 955 "LETTERLIKESYMBOLS"); 956 957 /** 958 * Constant for the "Number Forms" Unicode character block. 959 * @since 1.2 960 */ 961 public static final UnicodeBlock NUMBER_FORMS = 962 new UnicodeBlock("NUMBER_FORMS", 963 "NUMBER FORMS", 964 "NUMBERFORMS"); 965 966 /** 967 * Constant for the "Arrows" Unicode character block. 968 * @since 1.2 969 */ 970 public static final UnicodeBlock ARROWS = 971 new UnicodeBlock("ARROWS"); 972 973 /** 974 * Constant for the "Mathematical Operators" Unicode character block. 975 * @since 1.2 976 */ 977 public static final UnicodeBlock MATHEMATICAL_OPERATORS = 978 new UnicodeBlock("MATHEMATICAL_OPERATORS", 979 "MATHEMATICAL OPERATORS", 980 "MATHEMATICALOPERATORS"); 981 982 /** 983 * Constant for the "Miscellaneous Technical" Unicode character block. 984 * @since 1.2 985 */ 986 public static final UnicodeBlock MISCELLANEOUS_TECHNICAL = 987 new UnicodeBlock("MISCELLANEOUS_TECHNICAL", 988 "MISCELLANEOUS TECHNICAL", 989 "MISCELLANEOUSTECHNICAL"); 990 991 /** 992 * Constant for the "Control Pictures" Unicode character block. 993 * @since 1.2 994 */ 995 public static final UnicodeBlock CONTROL_PICTURES = 996 new UnicodeBlock("CONTROL_PICTURES", 997 "CONTROL PICTURES", 998 "CONTROLPICTURES"); 999 1000 /** 1001 * Constant for the "Optical Character Recognition" Unicode character block. 1002 * @since 1.2 1003 */ 1004 public static final UnicodeBlock OPTICAL_CHARACTER_RECOGNITION = 1005 new UnicodeBlock("OPTICAL_CHARACTER_RECOGNITION", 1006 "OPTICAL CHARACTER RECOGNITION", 1007 "OPTICALCHARACTERRECOGNITION"); 1008 1009 /** 1010 * Constant for the "Enclosed Alphanumerics" Unicode character block. 1011 * @since 1.2 1012 */ 1013 public static final UnicodeBlock ENCLOSED_ALPHANUMERICS = 1014 new UnicodeBlock("ENCLOSED_ALPHANUMERICS", 1015 "ENCLOSED ALPHANUMERICS", 1016 "ENCLOSEDALPHANUMERICS"); 1017 1018 /** 1019 * Constant for the "Box Drawing" Unicode character block. 1020 * @since 1.2 1021 */ 1022 public static final UnicodeBlock BOX_DRAWING = 1023 new UnicodeBlock("BOX_DRAWING", 1024 "BOX DRAWING", 1025 "BOXDRAWING"); 1026 1027 /** 1028 * Constant for the "Block Elements" Unicode character block. 1029 * @since 1.2 1030 */ 1031 public static final UnicodeBlock BLOCK_ELEMENTS = 1032 new UnicodeBlock("BLOCK_ELEMENTS", 1033 "BLOCK ELEMENTS", 1034 "BLOCKELEMENTS"); 1035 1036 /** 1037 * Constant for the "Geometric Shapes" Unicode character block. 1038 * @since 1.2 1039 */ 1040 public static final UnicodeBlock GEOMETRIC_SHAPES = 1041 new UnicodeBlock("GEOMETRIC_SHAPES", 1042 "GEOMETRIC SHAPES", 1043 "GEOMETRICSHAPES"); 1044 1045 /** 1046 * Constant for the "Miscellaneous Symbols" Unicode character block. 1047 * @since 1.2 1048 */ 1049 public static final UnicodeBlock MISCELLANEOUS_SYMBOLS = 1050 new UnicodeBlock("MISCELLANEOUS_SYMBOLS", 1051 "MISCELLANEOUS SYMBOLS", 1052 "MISCELLANEOUSSYMBOLS"); 1053 1054 /** 1055 * Constant for the "Dingbats" Unicode character block. 1056 * @since 1.2 1057 */ 1058 public static final UnicodeBlock DINGBATS = 1059 new UnicodeBlock("DINGBATS"); 1060 1061 /** 1062 * Constant for the "CJK Symbols and Punctuation" Unicode character block. 1063 * @since 1.2 1064 */ 1065 public static final UnicodeBlock CJK_SYMBOLS_AND_PUNCTUATION = 1066 new UnicodeBlock("CJK_SYMBOLS_AND_PUNCTUATION", 1067 "CJK SYMBOLS AND PUNCTUATION", 1068 "CJKSYMBOLSANDPUNCTUATION"); 1069 1070 /** 1071 * Constant for the "Hiragana" Unicode character block. 1072 * @since 1.2 1073 */ 1074 public static final UnicodeBlock HIRAGANA = 1075 new UnicodeBlock("HIRAGANA"); 1076 1077 /** 1078 * Constant for the "Katakana" Unicode character block. 1079 * @since 1.2 1080 */ 1081 public static final UnicodeBlock KATAKANA = 1082 new UnicodeBlock("KATAKANA"); 1083 1084 /** 1085 * Constant for the "Bopomofo" Unicode character block. 1086 * @since 1.2 1087 */ 1088 public static final UnicodeBlock BOPOMOFO = 1089 new UnicodeBlock("BOPOMOFO"); 1090 1091 /** 1092 * Constant for the "Hangul Compatibility Jamo" Unicode character block. 1093 * @since 1.2 1094 */ 1095 public static final UnicodeBlock HANGUL_COMPATIBILITY_JAMO = 1096 new UnicodeBlock("HANGUL_COMPATIBILITY_JAMO", 1097 "HANGUL COMPATIBILITY JAMO", 1098 "HANGULCOMPATIBILITYJAMO"); 1099 1100 /** 1101 * Constant for the "Kanbun" Unicode character block. 1102 * @since 1.2 1103 */ 1104 public static final UnicodeBlock KANBUN = 1105 new UnicodeBlock("KANBUN"); 1106 1107 /** 1108 * Constant for the "Enclosed CJK Letters and Months" Unicode character block. 1109 * @since 1.2 1110 */ 1111 public static final UnicodeBlock ENCLOSED_CJK_LETTERS_AND_MONTHS = 1112 new UnicodeBlock("ENCLOSED_CJK_LETTERS_AND_MONTHS", 1113 "ENCLOSED CJK LETTERS AND MONTHS", 1114 "ENCLOSEDCJKLETTERSANDMONTHS"); 1115 1116 /** 1117 * Constant for the "CJK Compatibility" Unicode character block. 1118 * @since 1.2 1119 */ 1120 public static final UnicodeBlock CJK_COMPATIBILITY = 1121 new UnicodeBlock("CJK_COMPATIBILITY", 1122 "CJK COMPATIBILITY", 1123 "CJKCOMPATIBILITY"); 1124 1125 /** 1126 * Constant for the "CJK Unified Ideographs" Unicode character block. 1127 * @since 1.2 1128 */ 1129 public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS = 1130 new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS", 1131 "CJK UNIFIED IDEOGRAPHS", 1132 "CJKUNIFIEDIDEOGRAPHS"); 1133 1134 /** 1135 * Constant for the "Hangul Syllables" Unicode character block. 1136 * @since 1.2 1137 */ 1138 public static final UnicodeBlock HANGUL_SYLLABLES = 1139 new UnicodeBlock("HANGUL_SYLLABLES", 1140 "HANGUL SYLLABLES", 1141 "HANGULSYLLABLES"); 1142 1143 /** 1144 * Constant for the "Private Use Area" Unicode character block. 1145 * @since 1.2 1146 */ 1147 public static final UnicodeBlock PRIVATE_USE_AREA = 1148 new UnicodeBlock("PRIVATE_USE_AREA", 1149 "PRIVATE USE AREA", 1150 "PRIVATEUSEAREA"); 1151 1152 /** 1153 * Constant for the "CJK Compatibility Ideographs" Unicode character 1154 * block. 1155 * @since 1.2 1156 */ 1157 public static final UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS = 1158 new UnicodeBlock("CJK_COMPATIBILITY_IDEOGRAPHS", 1159 "CJK COMPATIBILITY IDEOGRAPHS", 1160 "CJKCOMPATIBILITYIDEOGRAPHS"); 1161 1162 /** 1163 * Constant for the "Alphabetic Presentation Forms" Unicode character block. 1164 * @since 1.2 1165 */ 1166 public static final UnicodeBlock ALPHABETIC_PRESENTATION_FORMS = 1167 new UnicodeBlock("ALPHABETIC_PRESENTATION_FORMS", 1168 "ALPHABETIC PRESENTATION FORMS", 1169 "ALPHABETICPRESENTATIONFORMS"); 1170 1171 /** 1172 * Constant for the "Arabic Presentation Forms-A" Unicode character 1173 * block. 1174 * @since 1.2 1175 */ 1176 public static final UnicodeBlock ARABIC_PRESENTATION_FORMS_A = 1177 new UnicodeBlock("ARABIC_PRESENTATION_FORMS_A", 1178 "ARABIC PRESENTATION FORMS-A", 1179 "ARABICPRESENTATIONFORMS-A"); 1180 1181 /** 1182 * Constant for the "Combining Half Marks" Unicode character block. 1183 * @since 1.2 1184 */ 1185 public static final UnicodeBlock COMBINING_HALF_MARKS = 1186 new UnicodeBlock("COMBINING_HALF_MARKS", 1187 "COMBINING HALF MARKS", 1188 "COMBININGHALFMARKS"); 1189 1190 /** 1191 * Constant for the "CJK Compatibility Forms" Unicode character block. 1192 * @since 1.2 1193 */ 1194 public static final UnicodeBlock CJK_COMPATIBILITY_FORMS = 1195 new UnicodeBlock("CJK_COMPATIBILITY_FORMS", 1196 "CJK COMPATIBILITY FORMS", 1197 "CJKCOMPATIBILITYFORMS"); 1198 1199 /** 1200 * Constant for the "Small Form Variants" Unicode character block. 1201 * @since 1.2 1202 */ 1203 public static final UnicodeBlock SMALL_FORM_VARIANTS = 1204 new UnicodeBlock("SMALL_FORM_VARIANTS", 1205 "SMALL FORM VARIANTS", 1206 "SMALLFORMVARIANTS"); 1207 1208 /** 1209 * Constant for the "Arabic Presentation Forms-B" Unicode character block. 1210 * @since 1.2 1211 */ 1212 public static final UnicodeBlock ARABIC_PRESENTATION_FORMS_B = 1213 new UnicodeBlock("ARABIC_PRESENTATION_FORMS_B", 1214 "ARABIC PRESENTATION FORMS-B", 1215 "ARABICPRESENTATIONFORMS-B"); 1216 1217 /** 1218 * Constant for the "Halfwidth and Fullwidth Forms" Unicode character 1219 * block. 1220 * @since 1.2 1221 */ 1222 public static final UnicodeBlock HALFWIDTH_AND_FULLWIDTH_FORMS = 1223 new UnicodeBlock("HALFWIDTH_AND_FULLWIDTH_FORMS", 1224 "HALFWIDTH AND FULLWIDTH FORMS", 1225 "HALFWIDTHANDFULLWIDTHFORMS"); 1226 1227 /** 1228 * Constant for the "Specials" Unicode character block. 1229 * @since 1.2 1230 */ 1231 public static final UnicodeBlock SPECIALS = 1232 new UnicodeBlock("SPECIALS"); 1233 1234 /** 1235 * @deprecated As of J2SE 5, use {@link #HIGH_SURROGATES}, 1236 * {@link #HIGH_PRIVATE_USE_SURROGATES}, and 1237 * {@link #LOW_SURROGATES}. These new constants match 1238 * the block definitions of the Unicode Standard. 1239 * The {@link #of(char)} and {@link #of(int)} methods 1240 * return the new constants, not SURROGATES_AREA. 1241 */ 1242 @Deprecated 1243 public static final UnicodeBlock SURROGATES_AREA = 1244 new UnicodeBlock("SURROGATES_AREA"); 1245 1246 /** 1247 * Constant for the "Syriac" Unicode character block. 1248 * @since 1.4 1249 */ 1250 public static final UnicodeBlock SYRIAC = 1251 new UnicodeBlock("SYRIAC"); 1252 1253 /** 1254 * Constant for the "Thaana" Unicode character block. 1255 * @since 1.4 1256 */ 1257 public static final UnicodeBlock THAANA = 1258 new UnicodeBlock("THAANA"); 1259 1260 /** 1261 * Constant for the "Sinhala" Unicode character block. 1262 * @since 1.4 1263 */ 1264 public static final UnicodeBlock SINHALA = 1265 new UnicodeBlock("SINHALA"); 1266 1267 /** 1268 * Constant for the "Myanmar" Unicode character block. 1269 * @since 1.4 1270 */ 1271 public static final UnicodeBlock MYANMAR = 1272 new UnicodeBlock("MYANMAR"); 1273 1274 /** 1275 * Constant for the "Ethiopic" Unicode character block. 1276 * @since 1.4 1277 */ 1278 public static final UnicodeBlock ETHIOPIC = 1279 new UnicodeBlock("ETHIOPIC"); 1280 1281 /** 1282 * Constant for the "Cherokee" Unicode character block. 1283 * @since 1.4 1284 */ 1285 public static final UnicodeBlock CHEROKEE = 1286 new UnicodeBlock("CHEROKEE"); 1287 1288 /** 1289 * Constant for the "Unified Canadian Aboriginal Syllabics" Unicode character block. 1290 * @since 1.4 1291 */ 1292 public static final UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS = 1293 new UnicodeBlock("UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS", 1294 "UNIFIED CANADIAN ABORIGINAL SYLLABICS", 1295 "UNIFIEDCANADIANABORIGINALSYLLABICS"); 1296 1297 /** 1298 * Constant for the "Ogham" Unicode character block. 1299 * @since 1.4 1300 */ 1301 public static final UnicodeBlock OGHAM = 1302 new UnicodeBlock("OGHAM"); 1303 1304 /** 1305 * Constant for the "Runic" Unicode character block. 1306 * @since 1.4 1307 */ 1308 public static final UnicodeBlock RUNIC = 1309 new UnicodeBlock("RUNIC"); 1310 1311 /** 1312 * Constant for the "Khmer" Unicode character block. 1313 * @since 1.4 1314 */ 1315 public static final UnicodeBlock KHMER = 1316 new UnicodeBlock("KHMER"); 1317 1318 /** 1319 * Constant for the "Mongolian" Unicode character block. 1320 * @since 1.4 1321 */ 1322 public static final UnicodeBlock MONGOLIAN = 1323 new UnicodeBlock("MONGOLIAN"); 1324 1325 /** 1326 * Constant for the "Braille Patterns" Unicode character block. 1327 * @since 1.4 1328 */ 1329 public static final UnicodeBlock BRAILLE_PATTERNS = 1330 new UnicodeBlock("BRAILLE_PATTERNS", 1331 "BRAILLE PATTERNS", 1332 "BRAILLEPATTERNS"); 1333 1334 /** 1335 * Constant for the "CJK Radicals Supplement" Unicode character block. 1336 * @since 1.4 1337 */ 1338 public static final UnicodeBlock CJK_RADICALS_SUPPLEMENT = 1339 new UnicodeBlock("CJK_RADICALS_SUPPLEMENT", 1340 "CJK RADICALS SUPPLEMENT", 1341 "CJKRADICALSSUPPLEMENT"); 1342 1343 /** 1344 * Constant for the "Kangxi Radicals" Unicode character block. 1345 * @since 1.4 1346 */ 1347 public static final UnicodeBlock KANGXI_RADICALS = 1348 new UnicodeBlock("KANGXI_RADICALS", 1349 "KANGXI RADICALS", 1350 "KANGXIRADICALS"); 1351 1352 /** 1353 * Constant for the "Ideographic Description Characters" Unicode character block. 1354 * @since 1.4 1355 */ 1356 public static final UnicodeBlock IDEOGRAPHIC_DESCRIPTION_CHARACTERS = 1357 new UnicodeBlock("IDEOGRAPHIC_DESCRIPTION_CHARACTERS", 1358 "IDEOGRAPHIC DESCRIPTION CHARACTERS", 1359 "IDEOGRAPHICDESCRIPTIONCHARACTERS"); 1360 1361 /** 1362 * Constant for the "Bopomofo Extended" Unicode character block. 1363 * @since 1.4 1364 */ 1365 public static final UnicodeBlock BOPOMOFO_EXTENDED = 1366 new UnicodeBlock("BOPOMOFO_EXTENDED", 1367 "BOPOMOFO EXTENDED", 1368 "BOPOMOFOEXTENDED"); 1369 1370 /** 1371 * Constant for the "CJK Unified Ideographs Extension A" Unicode character block. 1372 * @since 1.4 1373 */ 1374 public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A = 1375 new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A", 1376 "CJK UNIFIED IDEOGRAPHS EXTENSION A", 1377 "CJKUNIFIEDIDEOGRAPHSEXTENSIONA"); 1378 1379 /** 1380 * Constant for the "Yi Syllables" Unicode character block. 1381 * @since 1.4 1382 */ 1383 public static final UnicodeBlock YI_SYLLABLES = 1384 new UnicodeBlock("YI_SYLLABLES", 1385 "YI SYLLABLES", 1386 "YISYLLABLES"); 1387 1388 /** 1389 * Constant for the "Yi Radicals" Unicode character block. 1390 * @since 1.4 1391 */ 1392 public static final UnicodeBlock YI_RADICALS = 1393 new UnicodeBlock("YI_RADICALS", 1394 "YI RADICALS", 1395 "YIRADICALS"); 1396 1397 /** 1398 * Constant for the "Cyrillic Supplementary" Unicode character block. 1399 * @since 1.5 1400 */ 1401 public static final UnicodeBlock CYRILLIC_SUPPLEMENTARY = 1402 new UnicodeBlock("CYRILLIC_SUPPLEMENTARY", 1403 "CYRILLIC SUPPLEMENTARY", 1404 "CYRILLICSUPPLEMENTARY", 1405 "CYRILLIC SUPPLEMENT", 1406 "CYRILLICSUPPLEMENT"); 1407 1408 /** 1409 * Constant for the "Tagalog" Unicode character block. 1410 * @since 1.5 1411 */ 1412 public static final UnicodeBlock TAGALOG = 1413 new UnicodeBlock("TAGALOG"); 1414 1415 /** 1416 * Constant for the "Hanunoo" Unicode character block. 1417 * @since 1.5 1418 */ 1419 public static final UnicodeBlock HANUNOO = 1420 new UnicodeBlock("HANUNOO"); 1421 1422 /** 1423 * Constant for the "Buhid" Unicode character block. 1424 * @since 1.5 1425 */ 1426 public static final UnicodeBlock BUHID = 1427 new UnicodeBlock("BUHID"); 1428 1429 /** 1430 * Constant for the "Tagbanwa" Unicode character block. 1431 * @since 1.5 1432 */ 1433 public static final UnicodeBlock TAGBANWA = 1434 new UnicodeBlock("TAGBANWA"); 1435 1436 /** 1437 * Constant for the "Limbu" Unicode character block. 1438 * @since 1.5 1439 */ 1440 public static final UnicodeBlock LIMBU = 1441 new UnicodeBlock("LIMBU"); 1442 1443 /** 1444 * Constant for the "Tai Le" Unicode character block. 1445 * @since 1.5 1446 */ 1447 public static final UnicodeBlock TAI_LE = 1448 new UnicodeBlock("TAI_LE", 1449 "TAI LE", 1450 "TAILE"); 1451 1452 /** 1453 * Constant for the "Khmer Symbols" Unicode character block. 1454 * @since 1.5 1455 */ 1456 public static final UnicodeBlock KHMER_SYMBOLS = 1457 new UnicodeBlock("KHMER_SYMBOLS", 1458 "KHMER SYMBOLS", 1459 "KHMERSYMBOLS"); 1460 1461 /** 1462 * Constant for the "Phonetic Extensions" Unicode character block. 1463 * @since 1.5 1464 */ 1465 public static final UnicodeBlock PHONETIC_EXTENSIONS = 1466 new UnicodeBlock("PHONETIC_EXTENSIONS", 1467 "PHONETIC EXTENSIONS", 1468 "PHONETICEXTENSIONS"); 1469 1470 /** 1471 * Constant for the "Miscellaneous Mathematical Symbols-A" Unicode character block. 1472 * @since 1.5 1473 */ 1474 public static final UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = 1475 new UnicodeBlock("MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A", 1476 "MISCELLANEOUS MATHEMATICAL SYMBOLS-A", 1477 "MISCELLANEOUSMATHEMATICALSYMBOLS-A"); 1478 1479 /** 1480 * Constant for the "Supplemental Arrows-A" Unicode character block. 1481 * @since 1.5 1482 */ 1483 public static final UnicodeBlock SUPPLEMENTAL_ARROWS_A = 1484 new UnicodeBlock("SUPPLEMENTAL_ARROWS_A", 1485 "SUPPLEMENTAL ARROWS-A", 1486 "SUPPLEMENTALARROWS-A"); 1487 1488 /** 1489 * Constant for the "Supplemental Arrows-B" Unicode character block. 1490 * @since 1.5 1491 */ 1492 public static final UnicodeBlock SUPPLEMENTAL_ARROWS_B = 1493 new UnicodeBlock("SUPPLEMENTAL_ARROWS_B", 1494 "SUPPLEMENTAL ARROWS-B", 1495 "SUPPLEMENTALARROWS-B"); 1496 1497 /** 1498 * Constant for the "Miscellaneous Mathematical Symbols-B" Unicode 1499 * character block. 1500 * @since 1.5 1501 */ 1502 public static final UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = 1503 new UnicodeBlock("MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B", 1504 "MISCELLANEOUS MATHEMATICAL SYMBOLS-B", 1505 "MISCELLANEOUSMATHEMATICALSYMBOLS-B"); 1506 1507 /** 1508 * Constant for the "Supplemental Mathematical Operators" Unicode 1509 * character block. 1510 * @since 1.5 1511 */ 1512 public static final UnicodeBlock SUPPLEMENTAL_MATHEMATICAL_OPERATORS = 1513 new UnicodeBlock("SUPPLEMENTAL_MATHEMATICAL_OPERATORS", 1514 "SUPPLEMENTAL MATHEMATICAL OPERATORS", 1515 "SUPPLEMENTALMATHEMATICALOPERATORS"); 1516 1517 /** 1518 * Constant for the "Miscellaneous Symbols and Arrows" Unicode character 1519 * block. 1520 * @since 1.5 1521 */ 1522 public static final UnicodeBlock MISCELLANEOUS_SYMBOLS_AND_ARROWS = 1523 new UnicodeBlock("MISCELLANEOUS_SYMBOLS_AND_ARROWS", 1524 "MISCELLANEOUS SYMBOLS AND ARROWS", 1525 "MISCELLANEOUSSYMBOLSANDARROWS"); 1526 1527 /** 1528 * Constant for the "Katakana Phonetic Extensions" Unicode character 1529 * block. 1530 * @since 1.5 1531 */ 1532 public static final UnicodeBlock KATAKANA_PHONETIC_EXTENSIONS = 1533 new UnicodeBlock("KATAKANA_PHONETIC_EXTENSIONS", 1534 "KATAKANA PHONETIC EXTENSIONS", 1535 "KATAKANAPHONETICEXTENSIONS"); 1536 1537 /** 1538 * Constant for the "Yijing Hexagram Symbols" Unicode character block. 1539 * @since 1.5 1540 */ 1541 public static final UnicodeBlock YIJING_HEXAGRAM_SYMBOLS = 1542 new UnicodeBlock("YIJING_HEXAGRAM_SYMBOLS", 1543 "YIJING HEXAGRAM SYMBOLS", 1544 "YIJINGHEXAGRAMSYMBOLS"); 1545 1546 /** 1547 * Constant for the "Variation Selectors" Unicode character block. 1548 * @since 1.5 1549 */ 1550 public static final UnicodeBlock VARIATION_SELECTORS = 1551 new UnicodeBlock("VARIATION_SELECTORS", 1552 "VARIATION SELECTORS", 1553 "VARIATIONSELECTORS"); 1554 1555 /** 1556 * Constant for the "Linear B Syllabary" Unicode character block. 1557 * @since 1.5 1558 */ 1559 public static final UnicodeBlock LINEAR_B_SYLLABARY = 1560 new UnicodeBlock("LINEAR_B_SYLLABARY", 1561 "LINEAR B SYLLABARY", 1562 "LINEARBSYLLABARY"); 1563 1564 /** 1565 * Constant for the "Linear B Ideograms" Unicode character block. 1566 * @since 1.5 1567 */ 1568 public static final UnicodeBlock LINEAR_B_IDEOGRAMS = 1569 new UnicodeBlock("LINEAR_B_IDEOGRAMS", 1570 "LINEAR B IDEOGRAMS", 1571 "LINEARBIDEOGRAMS"); 1572 1573 /** 1574 * Constant for the "Aegean Numbers" Unicode character block. 1575 * @since 1.5 1576 */ 1577 public static final UnicodeBlock AEGEAN_NUMBERS = 1578 new UnicodeBlock("AEGEAN_NUMBERS", 1579 "AEGEAN NUMBERS", 1580 "AEGEANNUMBERS"); 1581 1582 /** 1583 * Constant for the "Old Italic" Unicode character block. 1584 * @since 1.5 1585 */ 1586 public static final UnicodeBlock OLD_ITALIC = 1587 new UnicodeBlock("OLD_ITALIC", 1588 "OLD ITALIC", 1589 "OLDITALIC"); 1590 1591 /** 1592 * Constant for the "Gothic" Unicode character block. 1593 * @since 1.5 1594 */ 1595 public static final UnicodeBlock GOTHIC = 1596 new UnicodeBlock("GOTHIC"); 1597 1598 /** 1599 * Constant for the "Ugaritic" Unicode character block. 1600 * @since 1.5 1601 */ 1602 public static final UnicodeBlock UGARITIC = 1603 new UnicodeBlock("UGARITIC"); 1604 1605 /** 1606 * Constant for the "Deseret" Unicode character block. 1607 * @since 1.5 1608 */ 1609 public static final UnicodeBlock DESERET = 1610 new UnicodeBlock("DESERET"); 1611 1612 /** 1613 * Constant for the "Shavian" Unicode character block. 1614 * @since 1.5 1615 */ 1616 public static final UnicodeBlock SHAVIAN = 1617 new UnicodeBlock("SHAVIAN"); 1618 1619 /** 1620 * Constant for the "Osmanya" Unicode character block. 1621 * @since 1.5 1622 */ 1623 public static final UnicodeBlock OSMANYA = 1624 new UnicodeBlock("OSMANYA"); 1625 1626 /** 1627 * Constant for the "Cypriot Syllabary" Unicode character block. 1628 * @since 1.5 1629 */ 1630 public static final UnicodeBlock CYPRIOT_SYLLABARY = 1631 new UnicodeBlock("CYPRIOT_SYLLABARY", 1632 "CYPRIOT SYLLABARY", 1633 "CYPRIOTSYLLABARY"); 1634 1635 /** 1636 * Constant for the "Byzantine Musical Symbols" Unicode character block. 1637 * @since 1.5 1638 */ 1639 public static final UnicodeBlock BYZANTINE_MUSICAL_SYMBOLS = 1640 new UnicodeBlock("BYZANTINE_MUSICAL_SYMBOLS", 1641 "BYZANTINE MUSICAL SYMBOLS", 1642 "BYZANTINEMUSICALSYMBOLS"); 1643 1644 /** 1645 * Constant for the "Musical Symbols" Unicode character block. 1646 * @since 1.5 1647 */ 1648 public static final UnicodeBlock MUSICAL_SYMBOLS = 1649 new UnicodeBlock("MUSICAL_SYMBOLS", 1650 "MUSICAL SYMBOLS", 1651 "MUSICALSYMBOLS"); 1652 1653 /** 1654 * Constant for the "Tai Xuan Jing Symbols" Unicode character block. 1655 * @since 1.5 1656 */ 1657 public static final UnicodeBlock TAI_XUAN_JING_SYMBOLS = 1658 new UnicodeBlock("TAI_XUAN_JING_SYMBOLS", 1659 "TAI XUAN JING SYMBOLS", 1660 "TAIXUANJINGSYMBOLS"); 1661 1662 /** 1663 * Constant for the "Mathematical Alphanumeric Symbols" Unicode 1664 * character block. 1665 * @since 1.5 1666 */ 1667 public static final UnicodeBlock MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 1668 new UnicodeBlock("MATHEMATICAL_ALPHANUMERIC_SYMBOLS", 1669 "MATHEMATICAL ALPHANUMERIC SYMBOLS", 1670 "MATHEMATICALALPHANUMERICSYMBOLS"); 1671 1672 /** 1673 * Constant for the "CJK Unified Ideographs Extension B" Unicode 1674 * character block. 1675 * @since 1.5 1676 */ 1677 public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B = 1678 new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B", 1679 "CJK UNIFIED IDEOGRAPHS EXTENSION B", 1680 "CJKUNIFIEDIDEOGRAPHSEXTENSIONB"); 1681 1682 /** 1683 * Constant for the "CJK Compatibility Ideographs Supplement" Unicode character block. 1684 * @since 1.5 1685 */ 1686 public static final UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = 1687 new UnicodeBlock("CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT", 1688 "CJK COMPATIBILITY IDEOGRAPHS SUPPLEMENT", 1689 "CJKCOMPATIBILITYIDEOGRAPHSSUPPLEMENT"); 1690 1691 /** 1692 * Constant for the "Tags" Unicode character block. 1693 * @since 1.5 1694 */ 1695 public static final UnicodeBlock TAGS = 1696 new UnicodeBlock("TAGS"); 1697 1698 /** 1699 * Constant for the "Variation Selectors Supplement" Unicode character 1700 * block. 1701 * @since 1.5 1702 */ 1703 public static final UnicodeBlock VARIATION_SELECTORS_SUPPLEMENT = 1704 new UnicodeBlock("VARIATION_SELECTORS_SUPPLEMENT", 1705 "VARIATION SELECTORS SUPPLEMENT", 1706 "VARIATIONSELECTORSSUPPLEMENT"); 1707 1708 /** 1709 * Constant for the "Supplementary Private Use Area-A" Unicode character 1710 * block. 1711 * @since 1.5 1712 */ 1713 public static final UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_A = 1714 new UnicodeBlock("SUPPLEMENTARY_PRIVATE_USE_AREA_A", 1715 "SUPPLEMENTARY PRIVATE USE AREA-A", 1716 "SUPPLEMENTARYPRIVATEUSEAREA-A"); 1717 1718 /** 1719 * Constant for the "Supplementary Private Use Area-B" Unicode character 1720 * block. 1721 * @since 1.5 1722 */ 1723 public static final UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_B = 1724 new UnicodeBlock("SUPPLEMENTARY_PRIVATE_USE_AREA_B", 1725 "SUPPLEMENTARY PRIVATE USE AREA-B", 1726 "SUPPLEMENTARYPRIVATEUSEAREA-B"); 1727 1728 /** 1729 * Constant for the "High Surrogates" Unicode character block. 1730 * This block represents codepoint values in the high surrogate 1731 * range: U+D800 through U+DB7F 1732 * 1733 * @since 1.5 1734 */ 1735 public static final UnicodeBlock HIGH_SURROGATES = 1736 new UnicodeBlock("HIGH_SURROGATES", 1737 "HIGH SURROGATES", 1738 "HIGHSURROGATES"); 1739 1740 /** 1741 * Constant for the "High Private Use Surrogates" Unicode character 1742 * block. 1743 * This block represents codepoint values in the private use high 1744 * surrogate range: U+DB80 through U+DBFF 1745 * 1746 * @since 1.5 1747 */ 1748 public static final UnicodeBlock HIGH_PRIVATE_USE_SURROGATES = 1749 new UnicodeBlock("HIGH_PRIVATE_USE_SURROGATES", 1750 "HIGH PRIVATE USE SURROGATES", 1751 "HIGHPRIVATEUSESURROGATES"); 1752 1753 /** 1754 * Constant for the "Low Surrogates" Unicode character block. 1755 * This block represents codepoint values in the low surrogate 1756 * range: U+DC00 through U+DFFF 1757 * 1758 * @since 1.5 1759 */ 1760 public static final UnicodeBlock LOW_SURROGATES = 1761 new UnicodeBlock("LOW_SURROGATES", 1762 "LOW SURROGATES", 1763 "LOWSURROGATES"); 1764 1765 /** 1766 * Constant for the "Arabic Supplement" Unicode character block. 1767 * @since 1.7 1768 */ 1769 public static final UnicodeBlock ARABIC_SUPPLEMENT = 1770 new UnicodeBlock("ARABIC_SUPPLEMENT", 1771 "ARABIC SUPPLEMENT", 1772 "ARABICSUPPLEMENT"); 1773 1774 /** 1775 * Constant for the "NKo" Unicode character block. 1776 * @since 1.7 1777 */ 1778 public static final UnicodeBlock NKO = 1779 new UnicodeBlock("NKO"); 1780 1781 /** 1782 * Constant for the "Samaritan" Unicode character block. 1783 * @since 1.7 1784 */ 1785 public static final UnicodeBlock SAMARITAN = 1786 new UnicodeBlock("SAMARITAN"); 1787 1788 /** 1789 * Constant for the "Mandaic" Unicode character block. 1790 * @since 1.7 1791 */ 1792 public static final UnicodeBlock MANDAIC = 1793 new UnicodeBlock("MANDAIC"); 1794 1795 /** 1796 * Constant for the "Ethiopic Supplement" Unicode character block. 1797 * @since 1.7 1798 */ 1799 public static final UnicodeBlock ETHIOPIC_SUPPLEMENT = 1800 new UnicodeBlock("ETHIOPIC_SUPPLEMENT", 1801 "ETHIOPIC SUPPLEMENT", 1802 "ETHIOPICSUPPLEMENT"); 1803 1804 /** 1805 * Constant for the "Unified Canadian Aboriginal Syllabics Extended" 1806 * Unicode character block. 1807 * @since 1.7 1808 */ 1809 public static final UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = 1810 new UnicodeBlock("UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED", 1811 "UNIFIED CANADIAN ABORIGINAL SYLLABICS EXTENDED", 1812 "UNIFIEDCANADIANABORIGINALSYLLABICSEXTENDED"); 1813 1814 /** 1815 * Constant for the "New Tai Lue" Unicode character block. 1816 * @since 1.7 1817 */ 1818 public static final UnicodeBlock NEW_TAI_LUE = 1819 new UnicodeBlock("NEW_TAI_LUE", 1820 "NEW TAI LUE", 1821 "NEWTAILUE"); 1822 1823 /** 1824 * Constant for the "Buginese" Unicode character block. 1825 * @since 1.7 1826 */ 1827 public static final UnicodeBlock BUGINESE = 1828 new UnicodeBlock("BUGINESE"); 1829 1830 /** 1831 * Constant for the "Tai Tham" Unicode character block. 1832 * @since 1.7 1833 */ 1834 public static final UnicodeBlock TAI_THAM = 1835 new UnicodeBlock("TAI_THAM", 1836 "TAI THAM", 1837 "TAITHAM"); 1838 1839 /** 1840 * Constant for the "Balinese" Unicode character block. 1841 * @since 1.7 1842 */ 1843 public static final UnicodeBlock BALINESE = 1844 new UnicodeBlock("BALINESE"); 1845 1846 /** 1847 * Constant for the "Sundanese" Unicode character block. 1848 * @since 1.7 1849 */ 1850 public static final UnicodeBlock SUNDANESE = 1851 new UnicodeBlock("SUNDANESE"); 1852 1853 /** 1854 * Constant for the "Batak" Unicode character block. 1855 * @since 1.7 1856 */ 1857 public static final UnicodeBlock BATAK = 1858 new UnicodeBlock("BATAK"); 1859 1860 /** 1861 * Constant for the "Lepcha" Unicode character block. 1862 * @since 1.7 1863 */ 1864 public static final UnicodeBlock LEPCHA = 1865 new UnicodeBlock("LEPCHA"); 1866 1867 /** 1868 * Constant for the "Ol Chiki" Unicode character block. 1869 * @since 1.7 1870 */ 1871 public static final UnicodeBlock OL_CHIKI = 1872 new UnicodeBlock("OL_CHIKI", 1873 "OL CHIKI", 1874 "OLCHIKI"); 1875 1876 /** 1877 * Constant for the "Vedic Extensions" Unicode character block. 1878 * @since 1.7 1879 */ 1880 public static final UnicodeBlock VEDIC_EXTENSIONS = 1881 new UnicodeBlock("VEDIC_EXTENSIONS", 1882 "VEDIC EXTENSIONS", 1883 "VEDICEXTENSIONS"); 1884 1885 /** 1886 * Constant for the "Phonetic Extensions Supplement" Unicode character 1887 * block. 1888 * @since 1.7 1889 */ 1890 public static final UnicodeBlock PHONETIC_EXTENSIONS_SUPPLEMENT = 1891 new UnicodeBlock("PHONETIC_EXTENSIONS_SUPPLEMENT", 1892 "PHONETIC EXTENSIONS SUPPLEMENT", 1893 "PHONETICEXTENSIONSSUPPLEMENT"); 1894 1895 /** 1896 * Constant for the "Combining Diacritical Marks Supplement" Unicode 1897 * character block. 1898 * @since 1.7 1899 */ 1900 public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS_SUPPLEMENT = 1901 new UnicodeBlock("COMBINING_DIACRITICAL_MARKS_SUPPLEMENT", 1902 "COMBINING DIACRITICAL MARKS SUPPLEMENT", 1903 "COMBININGDIACRITICALMARKSSUPPLEMENT"); 1904 1905 /** 1906 * Constant for the "Glagolitic" Unicode character block. 1907 * @since 1.7 1908 */ 1909 public static final UnicodeBlock GLAGOLITIC = 1910 new UnicodeBlock("GLAGOLITIC"); 1911 1912 /** 1913 * Constant for the "Latin Extended-C" Unicode character block. 1914 * @since 1.7 1915 */ 1916 public static final UnicodeBlock LATIN_EXTENDED_C = 1917 new UnicodeBlock("LATIN_EXTENDED_C", 1918 "LATIN EXTENDED-C", 1919 "LATINEXTENDED-C"); 1920 1921 /** 1922 * Constant for the "Coptic" Unicode character block. 1923 * @since 1.7 1924 */ 1925 public static final UnicodeBlock COPTIC = 1926 new UnicodeBlock("COPTIC"); 1927 1928 /** 1929 * Constant for the "Georgian Supplement" Unicode character block. 1930 * @since 1.7 1931 */ 1932 public static final UnicodeBlock GEORGIAN_SUPPLEMENT = 1933 new UnicodeBlock("GEORGIAN_SUPPLEMENT", 1934 "GEORGIAN SUPPLEMENT", 1935 "GEORGIANSUPPLEMENT"); 1936 1937 /** 1938 * Constant for the "Tifinagh" Unicode character block. 1939 * @since 1.7 1940 */ 1941 public static final UnicodeBlock TIFINAGH = 1942 new UnicodeBlock("TIFINAGH"); 1943 1944 /** 1945 * Constant for the "Ethiopic Extended" Unicode character block. 1946 * @since 1.7 1947 */ 1948 public static final UnicodeBlock ETHIOPIC_EXTENDED = 1949 new UnicodeBlock("ETHIOPIC_EXTENDED", 1950 "ETHIOPIC EXTENDED", 1951 "ETHIOPICEXTENDED"); 1952 1953 /** 1954 * Constant for the "Cyrillic Extended-A" Unicode character block. 1955 * @since 1.7 1956 */ 1957 public static final UnicodeBlock CYRILLIC_EXTENDED_A = 1958 new UnicodeBlock("CYRILLIC_EXTENDED_A", 1959 "CYRILLIC EXTENDED-A", 1960 "CYRILLICEXTENDED-A"); 1961 1962 /** 1963 * Constant for the "Supplemental Punctuation" Unicode character block. 1964 * @since 1.7 1965 */ 1966 public static final UnicodeBlock SUPPLEMENTAL_PUNCTUATION = 1967 new UnicodeBlock("SUPPLEMENTAL_PUNCTUATION", 1968 "SUPPLEMENTAL PUNCTUATION", 1969 "SUPPLEMENTALPUNCTUATION"); 1970 1971 /** 1972 * Constant for the "CJK Strokes" Unicode character block. 1973 * @since 1.7 1974 */ 1975 public static final UnicodeBlock CJK_STROKES = 1976 new UnicodeBlock("CJK_STROKES", 1977 "CJK STROKES", 1978 "CJKSTROKES"); 1979 1980 /** 1981 * Constant for the "Lisu" Unicode character block. 1982 * @since 1.7 1983 */ 1984 public static final UnicodeBlock LISU = 1985 new UnicodeBlock("LISU"); 1986 1987 /** 1988 * Constant for the "Vai" Unicode character block. 1989 * @since 1.7 1990 */ 1991 public static final UnicodeBlock VAI = 1992 new UnicodeBlock("VAI"); 1993 1994 /** 1995 * Constant for the "Cyrillic Extended-B" Unicode character block. 1996 * @since 1.7 1997 */ 1998 public static final UnicodeBlock CYRILLIC_EXTENDED_B = 1999 new UnicodeBlock("CYRILLIC_EXTENDED_B", 2000 "CYRILLIC EXTENDED-B", 2001 "CYRILLICEXTENDED-B"); 2002 2003 /** 2004 * Constant for the "Bamum" Unicode character block. 2005 * @since 1.7 2006 */ 2007 public static final UnicodeBlock BAMUM = 2008 new UnicodeBlock("BAMUM"); 2009 2010 /** 2011 * Constant for the "Modifier Tone Letters" Unicode character block. 2012 * @since 1.7 2013 */ 2014 public static final UnicodeBlock MODIFIER_TONE_LETTERS = 2015 new UnicodeBlock("MODIFIER_TONE_LETTERS", 2016 "MODIFIER TONE LETTERS", 2017 "MODIFIERTONELETTERS"); 2018 2019 /** 2020 * Constant for the "Latin Extended-D" Unicode character block. 2021 * @since 1.7 2022 */ 2023 public static final UnicodeBlock LATIN_EXTENDED_D = 2024 new UnicodeBlock("LATIN_EXTENDED_D", 2025 "LATIN EXTENDED-D", 2026 "LATINEXTENDED-D"); 2027 2028 /** 2029 * Constant for the "Syloti Nagri" Unicode character block. 2030 * @since 1.7 2031 */ 2032 public static final UnicodeBlock SYLOTI_NAGRI = 2033 new UnicodeBlock("SYLOTI_NAGRI", 2034 "SYLOTI NAGRI", 2035 "SYLOTINAGRI"); 2036 2037 /** 2038 * Constant for the "Common Indic Number Forms" Unicode character block. 2039 * @since 1.7 2040 */ 2041 public static final UnicodeBlock COMMON_INDIC_NUMBER_FORMS = 2042 new UnicodeBlock("COMMON_INDIC_NUMBER_FORMS", 2043 "COMMON INDIC NUMBER FORMS", 2044 "COMMONINDICNUMBERFORMS"); 2045 2046 /** 2047 * Constant for the "Phags-pa" Unicode character block. 2048 * @since 1.7 2049 */ 2050 public static final UnicodeBlock PHAGS_PA = 2051 new UnicodeBlock("PHAGS_PA", 2052 "PHAGS-PA"); 2053 2054 /** 2055 * Constant for the "Saurashtra" Unicode character block. 2056 * @since 1.7 2057 */ 2058 public static final UnicodeBlock SAURASHTRA = 2059 new UnicodeBlock("SAURASHTRA"); 2060 2061 /** 2062 * Constant for the "Devanagari Extended" Unicode character block. 2063 * @since 1.7 2064 */ 2065 public static final UnicodeBlock DEVANAGARI_EXTENDED = 2066 new UnicodeBlock("DEVANAGARI_EXTENDED", 2067 "DEVANAGARI EXTENDED", 2068 "DEVANAGARIEXTENDED"); 2069 2070 /** 2071 * Constant for the "Kayah Li" Unicode character block. 2072 * @since 1.7 2073 */ 2074 public static final UnicodeBlock KAYAH_LI = 2075 new UnicodeBlock("KAYAH_LI", 2076 "KAYAH LI", 2077 "KAYAHLI"); 2078 2079 /** 2080 * Constant for the "Rejang" Unicode character block. 2081 * @since 1.7 2082 */ 2083 public static final UnicodeBlock REJANG = 2084 new UnicodeBlock("REJANG"); 2085 2086 /** 2087 * Constant for the "Hangul Jamo Extended-A" Unicode character block. 2088 * @since 1.7 2089 */ 2090 public static final UnicodeBlock HANGUL_JAMO_EXTENDED_A = 2091 new UnicodeBlock("HANGUL_JAMO_EXTENDED_A", 2092 "HANGUL JAMO EXTENDED-A", 2093 "HANGULJAMOEXTENDED-A"); 2094 2095 /** 2096 * Constant for the "Javanese" Unicode character block. 2097 * @since 1.7 2098 */ 2099 public static final UnicodeBlock JAVANESE = 2100 new UnicodeBlock("JAVANESE"); 2101 2102 /** 2103 * Constant for the "Cham" Unicode character block. 2104 * @since 1.7 2105 */ 2106 public static final UnicodeBlock CHAM = 2107 new UnicodeBlock("CHAM"); 2108 2109 /** 2110 * Constant for the "Myanmar Extended-A" Unicode character block. 2111 * @since 1.7 2112 */ 2113 public static final UnicodeBlock MYANMAR_EXTENDED_A = 2114 new UnicodeBlock("MYANMAR_EXTENDED_A", 2115 "MYANMAR EXTENDED-A", 2116 "MYANMAREXTENDED-A"); 2117 2118 /** 2119 * Constant for the "Tai Viet" Unicode character block. 2120 * @since 1.7 2121 */ 2122 public static final UnicodeBlock TAI_VIET = 2123 new UnicodeBlock("TAI_VIET", 2124 "TAI VIET", 2125 "TAIVIET"); 2126 2127 /** 2128 * Constant for the "Ethiopic Extended-A" Unicode character block. 2129 * @since 1.7 2130 */ 2131 public static final UnicodeBlock ETHIOPIC_EXTENDED_A = 2132 new UnicodeBlock("ETHIOPIC_EXTENDED_A", 2133 "ETHIOPIC EXTENDED-A", 2134 "ETHIOPICEXTENDED-A"); 2135 2136 /** 2137 * Constant for the "Meetei Mayek" Unicode character block. 2138 * @since 1.7 2139 */ 2140 public static final UnicodeBlock MEETEI_MAYEK = 2141 new UnicodeBlock("MEETEI_MAYEK", 2142 "MEETEI MAYEK", 2143 "MEETEIMAYEK"); 2144 2145 /** 2146 * Constant for the "Hangul Jamo Extended-B" Unicode character block. 2147 * @since 1.7 2148 */ 2149 public static final UnicodeBlock HANGUL_JAMO_EXTENDED_B = 2150 new UnicodeBlock("HANGUL_JAMO_EXTENDED_B", 2151 "HANGUL JAMO EXTENDED-B", 2152 "HANGULJAMOEXTENDED-B"); 2153 2154 /** 2155 * Constant for the "Vertical Forms" Unicode character block. 2156 * @since 1.7 2157 */ 2158 public static final UnicodeBlock VERTICAL_FORMS = 2159 new UnicodeBlock("VERTICAL_FORMS", 2160 "VERTICAL FORMS", 2161 "VERTICALFORMS"); 2162 2163 /** 2164 * Constant for the "Ancient Greek Numbers" Unicode character block. 2165 * @since 1.7 2166 */ 2167 public static final UnicodeBlock ANCIENT_GREEK_NUMBERS = 2168 new UnicodeBlock("ANCIENT_GREEK_NUMBERS", 2169 "ANCIENT GREEK NUMBERS", 2170 "ANCIENTGREEKNUMBERS"); 2171 2172 /** 2173 * Constant for the "Ancient Symbols" Unicode character block. 2174 * @since 1.7 2175 */ 2176 public static final UnicodeBlock ANCIENT_SYMBOLS = 2177 new UnicodeBlock("ANCIENT_SYMBOLS", 2178 "ANCIENT SYMBOLS", 2179 "ANCIENTSYMBOLS"); 2180 2181 /** 2182 * Constant for the "Phaistos Disc" Unicode character block. 2183 * @since 1.7 2184 */ 2185 public static final UnicodeBlock PHAISTOS_DISC = 2186 new UnicodeBlock("PHAISTOS_DISC", 2187 "PHAISTOS DISC", 2188 "PHAISTOSDISC"); 2189 2190 /** 2191 * Constant for the "Lycian" Unicode character block. 2192 * @since 1.7 2193 */ 2194 public static final UnicodeBlock LYCIAN = 2195 new UnicodeBlock("LYCIAN"); 2196 2197 /** 2198 * Constant for the "Carian" Unicode character block. 2199 * @since 1.7 2200 */ 2201 public static final UnicodeBlock CARIAN = 2202 new UnicodeBlock("CARIAN"); 2203 2204 /** 2205 * Constant for the "Old Persian" Unicode character block. 2206 * @since 1.7 2207 */ 2208 public static final UnicodeBlock OLD_PERSIAN = 2209 new UnicodeBlock("OLD_PERSIAN", 2210 "OLD PERSIAN", 2211 "OLDPERSIAN"); 2212 2213 /** 2214 * Constant for the "Imperial Aramaic" Unicode character block. 2215 * @since 1.7 2216 */ 2217 public static final UnicodeBlock IMPERIAL_ARAMAIC = 2218 new UnicodeBlock("IMPERIAL_ARAMAIC", 2219 "IMPERIAL ARAMAIC", 2220 "IMPERIALARAMAIC"); 2221 2222 /** 2223 * Constant for the "Phoenician" Unicode character block. 2224 * @since 1.7 2225 */ 2226 public static final UnicodeBlock PHOENICIAN = 2227 new UnicodeBlock("PHOENICIAN"); 2228 2229 /** 2230 * Constant for the "Lydian" Unicode character block. 2231 * @since 1.7 2232 */ 2233 public static final UnicodeBlock LYDIAN = 2234 new UnicodeBlock("LYDIAN"); 2235 2236 /** 2237 * Constant for the "Kharoshthi" Unicode character block. 2238 * @since 1.7 2239 */ 2240 public static final UnicodeBlock KHAROSHTHI = 2241 new UnicodeBlock("KHAROSHTHI"); 2242 2243 /** 2244 * Constant for the "Old South Arabian" Unicode character block. 2245 * @since 1.7 2246 */ 2247 public static final UnicodeBlock OLD_SOUTH_ARABIAN = 2248 new UnicodeBlock("OLD_SOUTH_ARABIAN", 2249 "OLD SOUTH ARABIAN", 2250 "OLDSOUTHARABIAN"); 2251 2252 /** 2253 * Constant for the "Avestan" Unicode character block. 2254 * @since 1.7 2255 */ 2256 public static final UnicodeBlock AVESTAN = 2257 new UnicodeBlock("AVESTAN"); 2258 2259 /** 2260 * Constant for the "Inscriptional Parthian" Unicode character block. 2261 * @since 1.7 2262 */ 2263 public static final UnicodeBlock INSCRIPTIONAL_PARTHIAN = 2264 new UnicodeBlock("INSCRIPTIONAL_PARTHIAN", 2265 "INSCRIPTIONAL PARTHIAN", 2266 "INSCRIPTIONALPARTHIAN"); 2267 2268 /** 2269 * Constant for the "Inscriptional Pahlavi" Unicode character block. 2270 * @since 1.7 2271 */ 2272 public static final UnicodeBlock INSCRIPTIONAL_PAHLAVI = 2273 new UnicodeBlock("INSCRIPTIONAL_PAHLAVI", 2274 "INSCRIPTIONAL PAHLAVI", 2275 "INSCRIPTIONALPAHLAVI"); 2276 2277 /** 2278 * Constant for the "Old Turkic" Unicode character block. 2279 * @since 1.7 2280 */ 2281 public static final UnicodeBlock OLD_TURKIC = 2282 new UnicodeBlock("OLD_TURKIC", 2283 "OLD TURKIC", 2284 "OLDTURKIC"); 2285 2286 /** 2287 * Constant for the "Rumi Numeral Symbols" Unicode character block. 2288 * @since 1.7 2289 */ 2290 public static final UnicodeBlock RUMI_NUMERAL_SYMBOLS = 2291 new UnicodeBlock("RUMI_NUMERAL_SYMBOLS", 2292 "RUMI NUMERAL SYMBOLS", 2293 "RUMINUMERALSYMBOLS"); 2294 2295 /** 2296 * Constant for the "Brahmi" Unicode character block. 2297 * @since 1.7 2298 */ 2299 public static final UnicodeBlock BRAHMI = 2300 new UnicodeBlock("BRAHMI"); 2301 2302 /** 2303 * Constant for the "Kaithi" Unicode character block. 2304 * @since 1.7 2305 */ 2306 public static final UnicodeBlock KAITHI = 2307 new UnicodeBlock("KAITHI"); 2308 2309 /** 2310 * Constant for the "Cuneiform" Unicode character block. 2311 * @since 1.7 2312 */ 2313 public static final UnicodeBlock CUNEIFORM = 2314 new UnicodeBlock("CUNEIFORM"); 2315 2316 /** 2317 * Constant for the "Cuneiform Numbers and Punctuation" Unicode 2318 * character block. 2319 * @since 1.7 2320 */ 2321 public static final UnicodeBlock CUNEIFORM_NUMBERS_AND_PUNCTUATION = 2322 new UnicodeBlock("CUNEIFORM_NUMBERS_AND_PUNCTUATION", 2323 "CUNEIFORM NUMBERS AND PUNCTUATION", 2324 "CUNEIFORMNUMBERSANDPUNCTUATION"); 2325 2326 /** 2327 * Constant for the "Egyptian Hieroglyphs" Unicode character block. 2328 * @since 1.7 2329 */ 2330 public static final UnicodeBlock EGYPTIAN_HIEROGLYPHS = 2331 new UnicodeBlock("EGYPTIAN_HIEROGLYPHS", 2332 "EGYPTIAN HIEROGLYPHS", 2333 "EGYPTIANHIEROGLYPHS"); 2334 2335 /** 2336 * Constant for the "Bamum Supplement" Unicode character block. 2337 * @since 1.7 2338 */ 2339 public static final UnicodeBlock BAMUM_SUPPLEMENT = 2340 new UnicodeBlock("BAMUM_SUPPLEMENT", 2341 "BAMUM SUPPLEMENT", 2342 "BAMUMSUPPLEMENT"); 2343 2344 /** 2345 * Constant for the "Kana Supplement" Unicode character block. 2346 * @since 1.7 2347 */ 2348 public static final UnicodeBlock KANA_SUPPLEMENT = 2349 new UnicodeBlock("KANA_SUPPLEMENT", 2350 "KANA SUPPLEMENT", 2351 "KANASUPPLEMENT"); 2352 2353 /** 2354 * Constant for the "Ancient Greek Musical Notation" Unicode character 2355 * block. 2356 * @since 1.7 2357 */ 2358 public static final UnicodeBlock ANCIENT_GREEK_MUSICAL_NOTATION = 2359 new UnicodeBlock("ANCIENT_GREEK_MUSICAL_NOTATION", 2360 "ANCIENT GREEK MUSICAL NOTATION", 2361 "ANCIENTGREEKMUSICALNOTATION"); 2362 2363 /** 2364 * Constant for the "Counting Rod Numerals" Unicode character block. 2365 * @since 1.7 2366 */ 2367 public static final UnicodeBlock COUNTING_ROD_NUMERALS = 2368 new UnicodeBlock("COUNTING_ROD_NUMERALS", 2369 "COUNTING ROD NUMERALS", 2370 "COUNTINGRODNUMERALS"); 2371 2372 /** 2373 * Constant for the "Mahjong Tiles" Unicode character block. 2374 * @since 1.7 2375 */ 2376 public static final UnicodeBlock MAHJONG_TILES = 2377 new UnicodeBlock("MAHJONG_TILES", 2378 "MAHJONG TILES", 2379 "MAHJONGTILES"); 2380 2381 /** 2382 * Constant for the "Domino Tiles" Unicode character block. 2383 * @since 1.7 2384 */ 2385 public static final UnicodeBlock DOMINO_TILES = 2386 new UnicodeBlock("DOMINO_TILES", 2387 "DOMINO TILES", 2388 "DOMINOTILES"); 2389 2390 /** 2391 * Constant for the "Playing Cards" Unicode character block. 2392 * @since 1.7 2393 */ 2394 public static final UnicodeBlock PLAYING_CARDS = 2395 new UnicodeBlock("PLAYING_CARDS", 2396 "PLAYING CARDS", 2397 "PLAYINGCARDS"); 2398 2399 /** 2400 * Constant for the "Enclosed Alphanumeric Supplement" Unicode character 2401 * block. 2402 * @since 1.7 2403 */ 2404 public static final UnicodeBlock ENCLOSED_ALPHANUMERIC_SUPPLEMENT = 2405 new UnicodeBlock("ENCLOSED_ALPHANUMERIC_SUPPLEMENT", 2406 "ENCLOSED ALPHANUMERIC SUPPLEMENT", 2407 "ENCLOSEDALPHANUMERICSUPPLEMENT"); 2408 2409 /** 2410 * Constant for the "Enclosed Ideographic Supplement" Unicode character 2411 * block. 2412 * @since 1.7 2413 */ 2414 public static final UnicodeBlock ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = 2415 new UnicodeBlock("ENCLOSED_IDEOGRAPHIC_SUPPLEMENT", 2416 "ENCLOSED IDEOGRAPHIC SUPPLEMENT", 2417 "ENCLOSEDIDEOGRAPHICSUPPLEMENT"); 2418 2419 /** 2420 * Constant for the "Miscellaneous Symbols And Pictographs" Unicode 2421 * character block. 2422 * @since 1.7 2423 */ 2424 public static final UnicodeBlock MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS = 2425 new UnicodeBlock("MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS", 2426 "MISCELLANEOUS SYMBOLS AND PICTOGRAPHS", 2427 "MISCELLANEOUSSYMBOLSANDPICTOGRAPHS"); 2428 2429 /** 2430 * Constant for the "Emoticons" Unicode character block. 2431 * @since 1.7 2432 */ 2433 public static final UnicodeBlock EMOTICONS = 2434 new UnicodeBlock("EMOTICONS"); 2435 2436 /** 2437 * Constant for the "Transport And Map Symbols" Unicode character block. 2438 * @since 1.7 2439 */ 2440 public static final UnicodeBlock TRANSPORT_AND_MAP_SYMBOLS = 2441 new UnicodeBlock("TRANSPORT_AND_MAP_SYMBOLS", 2442 "TRANSPORT AND MAP SYMBOLS", 2443 "TRANSPORTANDMAPSYMBOLS"); 2444 2445 /** 2446 * Constant for the "Alchemical Symbols" Unicode character block. 2447 * @since 1.7 2448 */ 2449 public static final UnicodeBlock ALCHEMICAL_SYMBOLS = 2450 new UnicodeBlock("ALCHEMICAL_SYMBOLS", 2451 "ALCHEMICAL SYMBOLS", 2452 "ALCHEMICALSYMBOLS"); 2453 2454 /** 2455 * Constant for the "CJK Unified Ideographs Extension C" Unicode 2456 * character block. 2457 * @since 1.7 2458 */ 2459 public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = 2460 new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C", 2461 "CJK UNIFIED IDEOGRAPHS EXTENSION C", 2462 "CJKUNIFIEDIDEOGRAPHSEXTENSIONC"); 2463 2464 /** 2465 * Constant for the "CJK Unified Ideographs Extension D" Unicode 2466 * character block. 2467 * @since 1.7 2468 */ 2469 public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D = 2470 new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D", 2471 "CJK UNIFIED IDEOGRAPHS EXTENSION D", 2472 "CJKUNIFIEDIDEOGRAPHSEXTENSIOND"); 2473 2474 /** 2475 * Constant for the "Arabic Extended-A" Unicode character block. 2476 * @since 1.8 2477 */ 2478 public static final UnicodeBlock ARABIC_EXTENDED_A = 2479 new UnicodeBlock("ARABIC_EXTENDED_A", 2480 "ARABIC EXTENDED-A", 2481 "ARABICEXTENDED-A"); 2482 2483 /** 2484 * Constant for the "Sundanese Supplement" Unicode character block. 2485 * @since 1.8 2486 */ 2487 public static final UnicodeBlock SUNDANESE_SUPPLEMENT = 2488 new UnicodeBlock("SUNDANESE_SUPPLEMENT", 2489 "SUNDANESE SUPPLEMENT", 2490 "SUNDANESESUPPLEMENT"); 2491 2492 /** 2493 * Constant for the "Meetei Mayek Extensions" Unicode character block. 2494 * @since 1.8 2495 */ 2496 public static final UnicodeBlock MEETEI_MAYEK_EXTENSIONS = 2497 new UnicodeBlock("MEETEI_MAYEK_EXTENSIONS", 2498 "MEETEI MAYEK EXTENSIONS", 2499 "MEETEIMAYEKEXTENSIONS"); 2500 2501 /** 2502 * Constant for the "Meroitic Hieroglyphs" Unicode character block. 2503 * @since 1.8 2504 */ 2505 public static final UnicodeBlock MEROITIC_HIEROGLYPHS = 2506 new UnicodeBlock("MEROITIC_HIEROGLYPHS", 2507 "MEROITIC HIEROGLYPHS", 2508 "MEROITICHIEROGLYPHS"); 2509 2510 /** 2511 * Constant for the "Meroitic Cursive" Unicode character block. 2512 * @since 1.8 2513 */ 2514 public static final UnicodeBlock MEROITIC_CURSIVE = 2515 new UnicodeBlock("MEROITIC_CURSIVE", 2516 "MEROITIC CURSIVE", 2517 "MEROITICCURSIVE"); 2518 2519 /** 2520 * Constant for the "Sora Sompeng" Unicode character block. 2521 * @since 1.8 2522 */ 2523 public static final UnicodeBlock SORA_SOMPENG = 2524 new UnicodeBlock("SORA_SOMPENG", 2525 "SORA SOMPENG", 2526 "SORASOMPENG"); 2527 2528 /** 2529 * Constant for the "Chakma" Unicode character block. 2530 * @since 1.8 2531 */ 2532 public static final UnicodeBlock CHAKMA = 2533 new UnicodeBlock("CHAKMA"); 2534 2535 /** 2536 * Constant for the "Sharada" Unicode character block. 2537 * @since 1.8 2538 */ 2539 public static final UnicodeBlock SHARADA = 2540 new UnicodeBlock("SHARADA"); 2541 2542 /** 2543 * Constant for the "Takri" Unicode character block. 2544 * @since 1.8 2545 */ 2546 public static final UnicodeBlock TAKRI = 2547 new UnicodeBlock("TAKRI"); 2548 2549 /** 2550 * Constant for the "Miao" Unicode character block. 2551 * @since 1.8 2552 */ 2553 public static final UnicodeBlock MIAO = 2554 new UnicodeBlock("MIAO"); 2555 2556 /** 2557 * Constant for the "Arabic Mathematical Alphabetic Symbols" Unicode 2558 * character block. 2559 * @since 1.8 2560 */ 2561 public static final UnicodeBlock ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS = 2562 new UnicodeBlock("ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS", 2563 "ARABIC MATHEMATICAL ALPHABETIC SYMBOLS", 2564 "ARABICMATHEMATICALALPHABETICSYMBOLS"); 2565 2566 private static final int blockStarts[] = { 2567 0x0000, // 0000..007F; Basic Latin 2568 0x0080, // 0080..00FF; Latin-1 Supplement 2569 0x0100, // 0100..017F; Latin Extended-A 2570 0x0180, // 0180..024F; Latin Extended-B 2571 0x0250, // 0250..02AF; IPA Extensions 2572 0x02B0, // 02B0..02FF; Spacing Modifier Letters 2573 0x0300, // 0300..036F; Combining Diacritical Marks 2574 0x0370, // 0370..03FF; Greek and Coptic 2575 0x0400, // 0400..04FF; Cyrillic 2576 0x0500, // 0500..052F; Cyrillic Supplement 2577 0x0530, // 0530..058F; Armenian 2578 0x0590, // 0590..05FF; Hebrew 2579 0x0600, // 0600..06FF; Arabic 2580 0x0700, // 0700..074F; Syriac 2581 0x0750, // 0750..077F; Arabic Supplement 2582 0x0780, // 0780..07BF; Thaana 2583 0x07C0, // 07C0..07FF; NKo 2584 0x0800, // 0800..083F; Samaritan 2585 0x0840, // 0840..085F; Mandaic 2586 0x0860, // unassigned 2587 0x08A0, // 08A0..08FF; Arabic Extended-A 2588 0x0900, // 0900..097F; Devanagari 2589 0x0980, // 0980..09FF; Bengali 2590 0x0A00, // 0A00..0A7F; Gurmukhi 2591 0x0A80, // 0A80..0AFF; Gujarati 2592 0x0B00, // 0B00..0B7F; Oriya 2593 0x0B80, // 0B80..0BFF; Tamil 2594 0x0C00, // 0C00..0C7F; Telugu 2595 0x0C80, // 0C80..0CFF; Kannada 2596 0x0D00, // 0D00..0D7F; Malayalam 2597 0x0D80, // 0D80..0DFF; Sinhala 2598 0x0E00, // 0E00..0E7F; Thai 2599 0x0E80, // 0E80..0EFF; Lao 2600 0x0F00, // 0F00..0FFF; Tibetan 2601 0x1000, // 1000..109F; Myanmar 2602 0x10A0, // 10A0..10FF; Georgian 2603 0x1100, // 1100..11FF; Hangul Jamo 2604 0x1200, // 1200..137F; Ethiopic 2605 0x1380, // 1380..139F; Ethiopic Supplement 2606 0x13A0, // 13A0..13FF; Cherokee 2607 0x1400, // 1400..167F; Unified Canadian Aboriginal Syllabics 2608 0x1680, // 1680..169F; Ogham 2609 0x16A0, // 16A0..16FF; Runic 2610 0x1700, // 1700..171F; Tagalog 2611 0x1720, // 1720..173F; Hanunoo 2612 0x1740, // 1740..175F; Buhid 2613 0x1760, // 1760..177F; Tagbanwa 2614 0x1780, // 1780..17FF; Khmer 2615 0x1800, // 1800..18AF; Mongolian 2616 0x18B0, // 18B0..18FF; Unified Canadian Aboriginal Syllabics Extended 2617 0x1900, // 1900..194F; Limbu 2618 0x1950, // 1950..197F; Tai Le 2619 0x1980, // 1980..19DF; New Tai Lue 2620 0x19E0, // 19E0..19FF; Khmer Symbols 2621 0x1A00, // 1A00..1A1F; Buginese 2622 0x1A20, // 1A20..1AAF; Tai Tham 2623 0x1AB0, // unassigned 2624 0x1B00, // 1B00..1B7F; Balinese 2625 0x1B80, // 1B80..1BBF; Sundanese 2626 0x1BC0, // 1BC0..1BFF; Batak 2627 0x1C00, // 1C00..1C4F; Lepcha 2628 0x1C50, // 1C50..1C7F; Ol Chiki 2629 0x1C80, // unassigned 2630 0x1CC0, // 1CC0..1CCF; Sundanese Supplement 2631 0x1CD0, // 1CD0..1CFF; Vedic Extensions 2632 0x1D00, // 1D00..1D7F; Phonetic Extensions 2633 0x1D80, // 1D80..1DBF; Phonetic Extensions Supplement 2634 0x1DC0, // 1DC0..1DFF; Combining Diacritical Marks Supplement 2635 0x1E00, // 1E00..1EFF; Latin Extended Additional 2636 0x1F00, // 1F00..1FFF; Greek Extended 2637 0x2000, // 2000..206F; General Punctuation 2638 0x2070, // 2070..209F; Superscripts and Subscripts 2639 0x20A0, // 20A0..20CF; Currency Symbols 2640 0x20D0, // 20D0..20FF; Combining Diacritical Marks for Symbols 2641 0x2100, // 2100..214F; Letterlike Symbols 2642 0x2150, // 2150..218F; Number Forms 2643 0x2190, // 2190..21FF; Arrows 2644 0x2200, // 2200..22FF; Mathematical Operators 2645 0x2300, // 2300..23FF; Miscellaneous Technical 2646 0x2400, // 2400..243F; Control Pictures 2647 0x2440, // 2440..245F; Optical Character Recognition 2648 0x2460, // 2460..24FF; Enclosed Alphanumerics 2649 0x2500, // 2500..257F; Box Drawing 2650 0x2580, // 2580..259F; Block Elements 2651 0x25A0, // 25A0..25FF; Geometric Shapes 2652 0x2600, // 2600..26FF; Miscellaneous Symbols 2653 0x2700, // 2700..27BF; Dingbats 2654 0x27C0, // 27C0..27EF; Miscellaneous Mathematical Symbols-A 2655 0x27F0, // 27F0..27FF; Supplemental Arrows-A 2656 0x2800, // 2800..28FF; Braille Patterns 2657 0x2900, // 2900..297F; Supplemental Arrows-B 2658 0x2980, // 2980..29FF; Miscellaneous Mathematical Symbols-B 2659 0x2A00, // 2A00..2AFF; Supplemental Mathematical Operators 2660 0x2B00, // 2B00..2BFF; Miscellaneous Symbols and Arrows 2661 0x2C00, // 2C00..2C5F; Glagolitic 2662 0x2C60, // 2C60..2C7F; Latin Extended-C 2663 0x2C80, // 2C80..2CFF; Coptic 2664 0x2D00, // 2D00..2D2F; Georgian Supplement 2665 0x2D30, // 2D30..2D7F; Tifinagh 2666 0x2D80, // 2D80..2DDF; Ethiopic Extended 2667 0x2DE0, // 2DE0..2DFF; Cyrillic Extended-A 2668 0x2E00, // 2E00..2E7F; Supplemental Punctuation 2669 0x2E80, // 2E80..2EFF; CJK Radicals Supplement 2670 0x2F00, // 2F00..2FDF; Kangxi Radicals 2671 0x2FE0, // unassigned 2672 0x2FF0, // 2FF0..2FFF; Ideographic Description Characters 2673 0x3000, // 3000..303F; CJK Symbols and Punctuation 2674 0x3040, // 3040..309F; Hiragana 2675 0x30A0, // 30A0..30FF; Katakana 2676 0x3100, // 3100..312F; Bopomofo 2677 0x3130, // 3130..318F; Hangul Compatibility Jamo 2678 0x3190, // 3190..319F; Kanbun 2679 0x31A0, // 31A0..31BF; Bopomofo Extended 2680 0x31C0, // 31C0..31EF; CJK Strokes 2681 0x31F0, // 31F0..31FF; Katakana Phonetic Extensions 2682 0x3200, // 3200..32FF; Enclosed CJK Letters and Months 2683 0x3300, // 3300..33FF; CJK Compatibility 2684 0x3400, // 3400..4DBF; CJK Unified Ideographs Extension A 2685 0x4DC0, // 4DC0..4DFF; Yijing Hexagram Symbols 2686 0x4E00, // 4E00..9FFF; CJK Unified Ideographs 2687 0xA000, // A000..A48F; Yi Syllables 2688 0xA490, // A490..A4CF; Yi Radicals 2689 0xA4D0, // A4D0..A4FF; Lisu 2690 0xA500, // A500..A63F; Vai 2691 0xA640, // A640..A69F; Cyrillic Extended-B 2692 0xA6A0, // A6A0..A6FF; Bamum 2693 0xA700, // A700..A71F; Modifier Tone Letters 2694 0xA720, // A720..A7FF; Latin Extended-D 2695 0xA800, // A800..A82F; Syloti Nagri 2696 0xA830, // A830..A83F; Common Indic Number Forms 2697 0xA840, // A840..A87F; Phags-pa 2698 0xA880, // A880..A8DF; Saurashtra 2699 0xA8E0, // A8E0..A8FF; Devanagari Extended 2700 0xA900, // A900..A92F; Kayah Li 2701 0xA930, // A930..A95F; Rejang 2702 0xA960, // A960..A97F; Hangul Jamo Extended-A 2703 0xA980, // A980..A9DF; Javanese 2704 0xA9E0, // unassigned 2705 0xAA00, // AA00..AA5F; Cham 2706 0xAA60, // AA60..AA7F; Myanmar Extended-A 2707 0xAA80, // AA80..AADF; Tai Viet 2708 0xAAE0, // AAE0..AAFF; Meetei Mayek Extensions 2709 0xAB00, // AB00..AB2F; Ethiopic Extended-A 2710 0xAB30, // unassigned 2711 0xABC0, // ABC0..ABFF; Meetei Mayek 2712 0xAC00, // AC00..D7AF; Hangul Syllables 2713 0xD7B0, // D7B0..D7FF; Hangul Jamo Extended-B 2714 0xD800, // D800..DB7F; High Surrogates 2715 0xDB80, // DB80..DBFF; High Private Use Surrogates 2716 0xDC00, // DC00..DFFF; Low Surrogates 2717 0xE000, // E000..F8FF; Private Use Area 2718 0xF900, // F900..FAFF; CJK Compatibility Ideographs 2719 0xFB00, // FB00..FB4F; Alphabetic Presentation Forms 2720 0xFB50, // FB50..FDFF; Arabic Presentation Forms-A 2721 0xFE00, // FE00..FE0F; Variation Selectors 2722 0xFE10, // FE10..FE1F; Vertical Forms 2723 0xFE20, // FE20..FE2F; Combining Half Marks 2724 0xFE30, // FE30..FE4F; CJK Compatibility Forms 2725 0xFE50, // FE50..FE6F; Small Form Variants 2726 0xFE70, // FE70..FEFF; Arabic Presentation Forms-B 2727 0xFF00, // FF00..FFEF; Halfwidth and Fullwidth Forms 2728 0xFFF0, // FFF0..FFFF; Specials 2729 0x10000, // 10000..1007F; Linear B Syllabary 2730 0x10080, // 10080..100FF; Linear B Ideograms 2731 0x10100, // 10100..1013F; Aegean Numbers 2732 0x10140, // 10140..1018F; Ancient Greek Numbers 2733 0x10190, // 10190..101CF; Ancient Symbols 2734 0x101D0, // 101D0..101FF; Phaistos Disc 2735 0x10200, // unassigned 2736 0x10280, // 10280..1029F; Lycian 2737 0x102A0, // 102A0..102DF; Carian 2738 0x102E0, // unassigned 2739 0x10300, // 10300..1032F; Old Italic 2740 0x10330, // 10330..1034F; Gothic 2741 0x10350, // unassigned 2742 0x10380, // 10380..1039F; Ugaritic 2743 0x103A0, // 103A0..103DF; Old Persian 2744 0x103E0, // unassigned 2745 0x10400, // 10400..1044F; Deseret 2746 0x10450, // 10450..1047F; Shavian 2747 0x10480, // 10480..104AF; Osmanya 2748 0x104B0, // unassigned 2749 0x10800, // 10800..1083F; Cypriot Syllabary 2750 0x10840, // 10840..1085F; Imperial Aramaic 2751 0x10860, // unassigned 2752 0x10900, // 10900..1091F; Phoenician 2753 0x10920, // 10920..1093F; Lydian 2754 0x10940, // unassigned 2755 0x10980, // 10980..1099F; Meroitic Hieroglyphs 2756 0x109A0, // 109A0..109FF; Meroitic Cursive 2757 0x10A00, // 10A00..10A5F; Kharoshthi 2758 0x10A60, // 10A60..10A7F; Old South Arabian 2759 0x10A80, // unassigned 2760 0x10B00, // 10B00..10B3F; Avestan 2761 0x10B40, // 10B40..10B5F; Inscriptional Parthian 2762 0x10B60, // 10B60..10B7F; Inscriptional Pahlavi 2763 0x10B80, // unassigned 2764 0x10C00, // 10C00..10C4F; Old Turkic 2765 0x10C50, // unassigned 2766 0x10E60, // 10E60..10E7F; Rumi Numeral Symbols 2767 0x10E80, // unassigned 2768 0x11000, // 11000..1107F; Brahmi 2769 0x11080, // 11080..110CF; Kaithi 2770 0x110D0, // 110D0..110FF; Sora Sompeng 2771 0x11100, // 11100..1114F; Chakma 2772 0x11150, // unassigned 2773 0x11180, // 11180..111DF; Sharada 2774 0x111E0, // unassigned 2775 0x11680, // 11680..116CF; Takri 2776 0x116D0, // unassigned 2777 0x12000, // 12000..123FF; Cuneiform 2778 0x12400, // 12400..1247F; Cuneiform Numbers and Punctuation 2779 0x12480, // unassigned 2780 0x13000, // 13000..1342F; Egyptian Hieroglyphs 2781 0x13430, // unassigned 2782 0x16800, // 16800..16A3F; Bamum Supplement 2783 0x16A40, // unassigned 2784 0x16F00, // 16F00..16F9F; Miao 2785 0x16FA0, // unassigned 2786 0x1B000, // 1B000..1B0FF; Kana Supplement 2787 0x1B100, // unassigned 2788 0x1D000, // 1D000..1D0FF; Byzantine Musical Symbols 2789 0x1D100, // 1D100..1D1FF; Musical Symbols 2790 0x1D200, // 1D200..1D24F; Ancient Greek Musical Notation 2791 0x1D250, // unassigned 2792 0x1D300, // 1D300..1D35F; Tai Xuan Jing Symbols 2793 0x1D360, // 1D360..1D37F; Counting Rod Numerals 2794 0x1D380, // unassigned 2795 0x1D400, // 1D400..1D7FF; Mathematical Alphanumeric Symbols 2796 0x1D800, // unassigned 2797 0x1EE00, // 1EE00..1EEFF; Arabic Mathematical Alphabetic Symbols 2798 0x1EF00, // unassigned 2799 0x1F000, // 1F000..1F02F; Mahjong Tiles 2800 0x1F030, // 1F030..1F09F; Domino Tiles 2801 0x1F0A0, // 1F0A0..1F0FF; Playing Cards 2802 0x1F100, // 1F100..1F1FF; Enclosed Alphanumeric Supplement 2803 0x1F200, // 1F200..1F2FF; Enclosed Ideographic Supplement 2804 0x1F300, // 1F300..1F5FF; Miscellaneous Symbols And Pictographs 2805 0x1F600, // 1F600..1F64F; Emoticons 2806 0x1F650, // unassigned 2807 0x1F680, // 1F680..1F6FF; Transport And Map Symbols 2808 0x1F700, // 1F700..1F77F; Alchemical Symbols 2809 0x1F780, // unassigned 2810 0x20000, // 20000..2A6DF; CJK Unified Ideographs Extension B 2811 0x2A6E0, // unassigned 2812 0x2A700, // 2A700..2B73F; CJK Unified Ideographs Extension C 2813 0x2B740, // 2B740..2B81F; CJK Unified Ideographs Extension D 2814 0x2B820, // unassigned 2815 0x2F800, // 2F800..2FA1F; CJK Compatibility Ideographs Supplement 2816 0x2FA20, // unassigned 2817 0xE0000, // E0000..E007F; Tags 2818 0xE0080, // unassigned 2819 0xE0100, // E0100..E01EF; Variation Selectors Supplement 2820 0xE01F0, // unassigned 2821 0xF0000, // F0000..FFFFF; Supplementary Private Use Area-A 2822 0x100000 // 100000..10FFFF; Supplementary Private Use Area-B 2823 }; 2824 2825 private static final UnicodeBlock[] blocks = { 2826 BASIC_LATIN, 2827 LATIN_1_SUPPLEMENT, 2828 LATIN_EXTENDED_A, 2829 LATIN_EXTENDED_B, 2830 IPA_EXTENSIONS, 2831 SPACING_MODIFIER_LETTERS, 2832 COMBINING_DIACRITICAL_MARKS, 2833 GREEK, 2834 CYRILLIC, 2835 CYRILLIC_SUPPLEMENTARY, 2836 ARMENIAN, 2837 HEBREW, 2838 ARABIC, 2839 SYRIAC, 2840 ARABIC_SUPPLEMENT, 2841 THAANA, 2842 NKO, 2843 SAMARITAN, 2844 MANDAIC, 2845 null, 2846 ARABIC_EXTENDED_A, 2847 DEVANAGARI, 2848 BENGALI, 2849 GURMUKHI, 2850 GUJARATI, 2851 ORIYA, 2852 TAMIL, 2853 TELUGU, 2854 KANNADA, 2855 MALAYALAM, 2856 SINHALA, 2857 THAI, 2858 LAO, 2859 TIBETAN, 2860 MYANMAR, 2861 GEORGIAN, 2862 HANGUL_JAMO, 2863 ETHIOPIC, 2864 ETHIOPIC_SUPPLEMENT, 2865 CHEROKEE, 2866 UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS, 2867 OGHAM, 2868 RUNIC, 2869 TAGALOG, 2870 HANUNOO, 2871 BUHID, 2872 TAGBANWA, 2873 KHMER, 2874 MONGOLIAN, 2875 UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED, 2876 LIMBU, 2877 TAI_LE, 2878 NEW_TAI_LUE, 2879 KHMER_SYMBOLS, 2880 BUGINESE, 2881 TAI_THAM, 2882 null, 2883 BALINESE, 2884 SUNDANESE, 2885 BATAK, 2886 LEPCHA, 2887 OL_CHIKI, 2888 null, 2889 SUNDANESE_SUPPLEMENT, 2890 VEDIC_EXTENSIONS, 2891 PHONETIC_EXTENSIONS, 2892 PHONETIC_EXTENSIONS_SUPPLEMENT, 2893 COMBINING_DIACRITICAL_MARKS_SUPPLEMENT, 2894 LATIN_EXTENDED_ADDITIONAL, 2895 GREEK_EXTENDED, 2896 GENERAL_PUNCTUATION, 2897 SUPERSCRIPTS_AND_SUBSCRIPTS, 2898 CURRENCY_SYMBOLS, 2899 COMBINING_MARKS_FOR_SYMBOLS, 2900 LETTERLIKE_SYMBOLS, 2901 NUMBER_FORMS, 2902 ARROWS, 2903 MATHEMATICAL_OPERATORS, 2904 MISCELLANEOUS_TECHNICAL, 2905 CONTROL_PICTURES, 2906 OPTICAL_CHARACTER_RECOGNITION, 2907 ENCLOSED_ALPHANUMERICS, 2908 BOX_DRAWING, 2909 BLOCK_ELEMENTS, 2910 GEOMETRIC_SHAPES, 2911 MISCELLANEOUS_SYMBOLS, 2912 DINGBATS, 2913 MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A, 2914 SUPPLEMENTAL_ARROWS_A, 2915 BRAILLE_PATTERNS, 2916 SUPPLEMENTAL_ARROWS_B, 2917 MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B, 2918 SUPPLEMENTAL_MATHEMATICAL_OPERATORS, 2919 MISCELLANEOUS_SYMBOLS_AND_ARROWS, 2920 GLAGOLITIC, 2921 LATIN_EXTENDED_C, 2922 COPTIC, 2923 GEORGIAN_SUPPLEMENT, 2924 TIFINAGH, 2925 ETHIOPIC_EXTENDED, 2926 CYRILLIC_EXTENDED_A, 2927 SUPPLEMENTAL_PUNCTUATION, 2928 CJK_RADICALS_SUPPLEMENT, 2929 KANGXI_RADICALS, 2930 null, 2931 IDEOGRAPHIC_DESCRIPTION_CHARACTERS, 2932 CJK_SYMBOLS_AND_PUNCTUATION, 2933 HIRAGANA, 2934 KATAKANA, 2935 BOPOMOFO, 2936 HANGUL_COMPATIBILITY_JAMO, 2937 KANBUN, 2938 BOPOMOFO_EXTENDED, 2939 CJK_STROKES, 2940 KATAKANA_PHONETIC_EXTENSIONS, 2941 ENCLOSED_CJK_LETTERS_AND_MONTHS, 2942 CJK_COMPATIBILITY, 2943 CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A, 2944 YIJING_HEXAGRAM_SYMBOLS, 2945 CJK_UNIFIED_IDEOGRAPHS, 2946 YI_SYLLABLES, 2947 YI_RADICALS, 2948 LISU, 2949 VAI, 2950 CYRILLIC_EXTENDED_B, 2951 BAMUM, 2952 MODIFIER_TONE_LETTERS, 2953 LATIN_EXTENDED_D, 2954 SYLOTI_NAGRI, 2955 COMMON_INDIC_NUMBER_FORMS, 2956 PHAGS_PA, 2957 SAURASHTRA, 2958 DEVANAGARI_EXTENDED, 2959 KAYAH_LI, 2960 REJANG, 2961 HANGUL_JAMO_EXTENDED_A, 2962 JAVANESE, 2963 null, 2964 CHAM, 2965 MYANMAR_EXTENDED_A, 2966 TAI_VIET, 2967 MEETEI_MAYEK_EXTENSIONS, 2968 ETHIOPIC_EXTENDED_A, 2969 null, 2970 MEETEI_MAYEK, 2971 HANGUL_SYLLABLES, 2972 HANGUL_JAMO_EXTENDED_B, 2973 HIGH_SURROGATES, 2974 HIGH_PRIVATE_USE_SURROGATES, 2975 LOW_SURROGATES, 2976 PRIVATE_USE_AREA, 2977 CJK_COMPATIBILITY_IDEOGRAPHS, 2978 ALPHABETIC_PRESENTATION_FORMS, 2979 ARABIC_PRESENTATION_FORMS_A, 2980 VARIATION_SELECTORS, 2981 VERTICAL_FORMS, 2982 COMBINING_HALF_MARKS, 2983 CJK_COMPATIBILITY_FORMS, 2984 SMALL_FORM_VARIANTS, 2985 ARABIC_PRESENTATION_FORMS_B, 2986 HALFWIDTH_AND_FULLWIDTH_FORMS, 2987 SPECIALS, 2988 LINEAR_B_SYLLABARY, 2989 LINEAR_B_IDEOGRAMS, 2990 AEGEAN_NUMBERS, 2991 ANCIENT_GREEK_NUMBERS, 2992 ANCIENT_SYMBOLS, 2993 PHAISTOS_DISC, 2994 null, 2995 LYCIAN, 2996 CARIAN, 2997 null, 2998 OLD_ITALIC, 2999 GOTHIC, 3000 null, 3001 UGARITIC, 3002 OLD_PERSIAN, 3003 null, 3004 DESERET, 3005 SHAVIAN, 3006 OSMANYA, 3007 null, 3008 CYPRIOT_SYLLABARY, 3009 IMPERIAL_ARAMAIC, 3010 null, 3011 PHOENICIAN, 3012 LYDIAN, 3013 null, 3014 MEROITIC_HIEROGLYPHS, 3015 MEROITIC_CURSIVE, 3016 KHAROSHTHI, 3017 OLD_SOUTH_ARABIAN, 3018 null, 3019 AVESTAN, 3020 INSCRIPTIONAL_PARTHIAN, 3021 INSCRIPTIONAL_PAHLAVI, 3022 null, 3023 OLD_TURKIC, 3024 null, 3025 RUMI_NUMERAL_SYMBOLS, 3026 null, 3027 BRAHMI, 3028 KAITHI, 3029 SORA_SOMPENG, 3030 CHAKMA, 3031 null, 3032 SHARADA, 3033 null, 3034 TAKRI, 3035 null, 3036 CUNEIFORM, 3037 CUNEIFORM_NUMBERS_AND_PUNCTUATION, 3038 null, 3039 EGYPTIAN_HIEROGLYPHS, 3040 null, 3041 BAMUM_SUPPLEMENT, 3042 null, 3043 MIAO, 3044 null, 3045 KANA_SUPPLEMENT, 3046 null, 3047 BYZANTINE_MUSICAL_SYMBOLS, 3048 MUSICAL_SYMBOLS, 3049 ANCIENT_GREEK_MUSICAL_NOTATION, 3050 null, 3051 TAI_XUAN_JING_SYMBOLS, 3052 COUNTING_ROD_NUMERALS, 3053 null, 3054 MATHEMATICAL_ALPHANUMERIC_SYMBOLS, 3055 null, 3056 ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS, 3057 null, 3058 MAHJONG_TILES, 3059 DOMINO_TILES, 3060 PLAYING_CARDS, 3061 ENCLOSED_ALPHANUMERIC_SUPPLEMENT, 3062 ENCLOSED_IDEOGRAPHIC_SUPPLEMENT, 3063 MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS, 3064 EMOTICONS, 3065 null, 3066 TRANSPORT_AND_MAP_SYMBOLS, 3067 ALCHEMICAL_SYMBOLS, 3068 null, 3069 CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B, 3070 null, 3071 CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C, 3072 CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D, 3073 null, 3074 CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT, 3075 null, 3076 TAGS, 3077 null, 3078 VARIATION_SELECTORS_SUPPLEMENT, 3079 null, 3080 SUPPLEMENTARY_PRIVATE_USE_AREA_A, 3081 SUPPLEMENTARY_PRIVATE_USE_AREA_B 3082 }; 3083 3084 3085 /** 3086 * Returns the object representing the Unicode block containing the 3087 * given character, or {@code null} if the character is not a 3088 * member of a defined block. 3089 * 3090 * <p><b>Note:</b> This method cannot handle 3091 * <a href="Character.html#supplementary"> supplementary 3092 * characters</a>. To support all Unicode characters, including 3093 * supplementary characters, use the {@link #of(int)} method. 3094 * 3095 * @param c The character in question 3096 * @return The {@code UnicodeBlock} instance representing the 3097 * Unicode block of which this character is a member, or 3098 * {@code null} if the character is not a member of any 3099 * Unicode block 3100 */ 3101 public static UnicodeBlock of(char c) { 3102 return of((int)c); 3103 } 3104 3105 /** 3106 * Returns the object representing the Unicode block 3107 * containing the given character (Unicode code point), or 3108 * {@code null} if the character is not a member of a 3109 * defined block. 3110 * 3111 * @param codePoint the character (Unicode code point) in question. 3112 * @return The {@code UnicodeBlock} instance representing the 3113 * Unicode block of which this character is a member, or 3114 * {@code null} if the character is not a member of any 3115 * Unicode block 3116 * @exception IllegalArgumentException if the specified 3117 * {@code codePoint} is an invalid Unicode code point. 3118 * @see Character#isValidCodePoint(int) 3119 * @since 1.5 3120 */ 3121 public static UnicodeBlock of(int codePoint) { 3122 if (!isValidCodePoint(codePoint)) { 3123 throw new IllegalArgumentException(); 3124 } 3125 3126 int top, bottom, current; 3127 bottom = 0; 3128 top = blockStarts.length; 3129 current = top/2; 3130 3131 // invariant: top > current >= bottom && codePoint >= unicodeBlockStarts[bottom] 3132 while (top - bottom > 1) { 3133 if (codePoint >= blockStarts[current]) { 3134 bottom = current; 3135 } else { 3136 top = current; 3137 } 3138 current = (top + bottom) / 2; 3139 } 3140 return blocks[current]; 3141 } 3142 3143 /** 3144 * Returns the UnicodeBlock with the given name. Block 3145 * names are determined by The Unicode Standard. The file 3146 * Blocks-<version>.txt defines blocks for a particular 3147 * version of the standard. The {@link Character} class specifies 3148 * the version of the standard that it supports. 3149 * <p> 3150 * This method accepts block names in the following forms: 3151 * <ol> 3152 * <li> Canonical block names as defined by the Unicode Standard. 3153 * For example, the standard defines a "Basic Latin" block. Therefore, this 3154 * method accepts "Basic Latin" as a valid block name. The documentation of 3155 * each UnicodeBlock provides the canonical name. 3156 * <li>Canonical block names with all spaces removed. For example, "BasicLatin" 3157 * is a valid block name for the "Basic Latin" block. 3158 * <li>The text representation of each constant UnicodeBlock identifier. 3159 * For example, this method will return the {@link #BASIC_LATIN} block if 3160 * provided with the "BASIC_LATIN" name. This form replaces all spaces and 3161 * hyphens in the canonical name with underscores. 3162 * </ol> 3163 * Finally, character case is ignored for all of the valid block name forms. 3164 * For example, "BASIC_LATIN" and "basic_latin" are both valid block names. 3165 * The en_US locale's case mapping rules are used to provide case-insensitive 3166 * string comparisons for block name validation. 3167 * <p> 3168 * If the Unicode Standard changes block names, both the previous and 3169 * current names will be accepted. 3170 * 3171 * @param blockName A {@code UnicodeBlock} name. 3172 * @return The {@code UnicodeBlock} instance identified 3173 * by {@code blockName} 3174 * @throws IllegalArgumentException if {@code blockName} is an 3175 * invalid name 3176 * @throws NullPointerException if {@code blockName} is null 3177 * @since 1.5 3178 */ 3179 public static final UnicodeBlock forName(String blockName) { 3180 UnicodeBlock block = map.get(blockName.toUpperCase(Locale.US)); 3181 if (block == null) { 3182 throw new IllegalArgumentException(); 3183 } 3184 return block; 3185 } 3186 } 3187 3188 3189 /** 3190 * A family of character subsets representing the character scripts 3191 * defined in the <a href="http://www.unicode.org/reports/tr24/"> 3192 * <i>Unicode Standard Annex #24: Script Names</i></a>. Every Unicode 3193 * character is assigned to a single Unicode script, either a specific 3194 * script, such as {@link Character.UnicodeScript#LATIN Latin}, or 3195 * one of the following three special values, 3196 * {@link Character.UnicodeScript#INHERITED Inherited}, 3197 * {@link Character.UnicodeScript#COMMON Common} or 3198 * {@link Character.UnicodeScript#UNKNOWN Unknown}. 3199 * 3200 * @since 1.7 3201 */ 3202 public static enum UnicodeScript { 3203 /** 3204 * Unicode script "Common". 3205 */ 3206 COMMON, 3207 3208 /** 3209 * Unicode script "Latin". 3210 */ 3211 LATIN, 3212 3213 /** 3214 * Unicode script "Greek". 3215 */ 3216 GREEK, 3217 3218 /** 3219 * Unicode script "Cyrillic". 3220 */ 3221 CYRILLIC, 3222 3223 /** 3224 * Unicode script "Armenian". 3225 */ 3226 ARMENIAN, 3227 3228 /** 3229 * Unicode script "Hebrew". 3230 */ 3231 HEBREW, 3232 3233 /** 3234 * Unicode script "Arabic". 3235 */ 3236 ARABIC, 3237 3238 /** 3239 * Unicode script "Syriac". 3240 */ 3241 SYRIAC, 3242 3243 /** 3244 * Unicode script "Thaana". 3245 */ 3246 THAANA, 3247 3248 /** 3249 * Unicode script "Devanagari". 3250 */ 3251 DEVANAGARI, 3252 3253 /** 3254 * Unicode script "Bengali". 3255 */ 3256 BENGALI, 3257 3258 /** 3259 * Unicode script "Gurmukhi". 3260 */ 3261 GURMUKHI, 3262 3263 /** 3264 * Unicode script "Gujarati". 3265 */ 3266 GUJARATI, 3267 3268 /** 3269 * Unicode script "Oriya". 3270 */ 3271 ORIYA, 3272 3273 /** 3274 * Unicode script "Tamil". 3275 */ 3276 TAMIL, 3277 3278 /** 3279 * Unicode script "Telugu". 3280 */ 3281 TELUGU, 3282 3283 /** 3284 * Unicode script "Kannada". 3285 */ 3286 KANNADA, 3287 3288 /** 3289 * Unicode script "Malayalam". 3290 */ 3291 MALAYALAM, 3292 3293 /** 3294 * Unicode script "Sinhala". 3295 */ 3296 SINHALA, 3297 3298 /** 3299 * Unicode script "Thai". 3300 */ 3301 THAI, 3302 3303 /** 3304 * Unicode script "Lao". 3305 */ 3306 LAO, 3307 3308 /** 3309 * Unicode script "Tibetan". 3310 */ 3311 TIBETAN, 3312 3313 /** 3314 * Unicode script "Myanmar". 3315 */ 3316 MYANMAR, 3317 3318 /** 3319 * Unicode script "Georgian". 3320 */ 3321 GEORGIAN, 3322 3323 /** 3324 * Unicode script "Hangul". 3325 */ 3326 HANGUL, 3327 3328 /** 3329 * Unicode script "Ethiopic". 3330 */ 3331 ETHIOPIC, 3332 3333 /** 3334 * Unicode script "Cherokee". 3335 */ 3336 CHEROKEE, 3337 3338 /** 3339 * Unicode script "Canadian_Aboriginal". 3340 */ 3341 CANADIAN_ABORIGINAL, 3342 3343 /** 3344 * Unicode script "Ogham". 3345 */ 3346 OGHAM, 3347 3348 /** 3349 * Unicode script "Runic". 3350 */ 3351 RUNIC, 3352 3353 /** 3354 * Unicode script "Khmer". 3355 */ 3356 KHMER, 3357 3358 /** 3359 * Unicode script "Mongolian". 3360 */ 3361 MONGOLIAN, 3362 3363 /** 3364 * Unicode script "Hiragana". 3365 */ 3366 HIRAGANA, 3367 3368 /** 3369 * Unicode script "Katakana". 3370 */ 3371 KATAKANA, 3372 3373 /** 3374 * Unicode script "Bopomofo". 3375 */ 3376 BOPOMOFO, 3377 3378 /** 3379 * Unicode script "Han". 3380 */ 3381 HAN, 3382 3383 /** 3384 * Unicode script "Yi". 3385 */ 3386 YI, 3387 3388 /** 3389 * Unicode script "Old_Italic". 3390 */ 3391 OLD_ITALIC, 3392 3393 /** 3394 * Unicode script "Gothic". 3395 */ 3396 GOTHIC, 3397 3398 /** 3399 * Unicode script "Deseret". 3400 */ 3401 DESERET, 3402 3403 /** 3404 * Unicode script "Inherited". 3405 */ 3406 INHERITED, 3407 3408 /** 3409 * Unicode script "Tagalog". 3410 */ 3411 TAGALOG, 3412 3413 /** 3414 * Unicode script "Hanunoo". 3415 */ 3416 HANUNOO, 3417 3418 /** 3419 * Unicode script "Buhid". 3420 */ 3421 BUHID, 3422 3423 /** 3424 * Unicode script "Tagbanwa". 3425 */ 3426 TAGBANWA, 3427 3428 /** 3429 * Unicode script "Limbu". 3430 */ 3431 LIMBU, 3432 3433 /** 3434 * Unicode script "Tai_Le". 3435 */ 3436 TAI_LE, 3437 3438 /** 3439 * Unicode script "Linear_B". 3440 */ 3441 LINEAR_B, 3442 3443 /** 3444 * Unicode script "Ugaritic". 3445 */ 3446 UGARITIC, 3447 3448 /** 3449 * Unicode script "Shavian". 3450 */ 3451 SHAVIAN, 3452 3453 /** 3454 * Unicode script "Osmanya". 3455 */ 3456 OSMANYA, 3457 3458 /** 3459 * Unicode script "Cypriot". 3460 */ 3461 CYPRIOT, 3462 3463 /** 3464 * Unicode script "Braille". 3465 */ 3466 BRAILLE, 3467 3468 /** 3469 * Unicode script "Buginese". 3470 */ 3471 BUGINESE, 3472 3473 /** 3474 * Unicode script "Coptic". 3475 */ 3476 COPTIC, 3477 3478 /** 3479 * Unicode script "New_Tai_Lue". 3480 */ 3481 NEW_TAI_LUE, 3482 3483 /** 3484 * Unicode script "Glagolitic". 3485 */ 3486 GLAGOLITIC, 3487 3488 /** 3489 * Unicode script "Tifinagh". 3490 */ 3491 TIFINAGH, 3492 3493 /** 3494 * Unicode script "Syloti_Nagri". 3495 */ 3496 SYLOTI_NAGRI, 3497 3498 /** 3499 * Unicode script "Old_Persian". 3500 */ 3501 OLD_PERSIAN, 3502 3503 /** 3504 * Unicode script "Kharoshthi". 3505 */ 3506 KHAROSHTHI, 3507 3508 /** 3509 * Unicode script "Balinese". 3510 */ 3511 BALINESE, 3512 3513 /** 3514 * Unicode script "Cuneiform". 3515 */ 3516 CUNEIFORM, 3517 3518 /** 3519 * Unicode script "Phoenician". 3520 */ 3521 PHOENICIAN, 3522 3523 /** 3524 * Unicode script "Phags_Pa". 3525 */ 3526 PHAGS_PA, 3527 3528 /** 3529 * Unicode script "Nko". 3530 */ 3531 NKO, 3532 3533 /** 3534 * Unicode script "Sundanese". 3535 */ 3536 SUNDANESE, 3537 3538 /** 3539 * Unicode script "Batak". 3540 */ 3541 BATAK, 3542 3543 /** 3544 * Unicode script "Lepcha". 3545 */ 3546 LEPCHA, 3547 3548 /** 3549 * Unicode script "Ol_Chiki". 3550 */ 3551 OL_CHIKI, 3552 3553 /** 3554 * Unicode script "Vai". 3555 */ 3556 VAI, 3557 3558 /** 3559 * Unicode script "Saurashtra". 3560 */ 3561 SAURASHTRA, 3562 3563 /** 3564 * Unicode script "Kayah_Li". 3565 */ 3566 KAYAH_LI, 3567 3568 /** 3569 * Unicode script "Rejang". 3570 */ 3571 REJANG, 3572 3573 /** 3574 * Unicode script "Lycian". 3575 */ 3576 LYCIAN, 3577 3578 /** 3579 * Unicode script "Carian". 3580 */ 3581 CARIAN, 3582 3583 /** 3584 * Unicode script "Lydian". 3585 */ 3586 LYDIAN, 3587 3588 /** 3589 * Unicode script "Cham". 3590 */ 3591 CHAM, 3592 3593 /** 3594 * Unicode script "Tai_Tham". 3595 */ 3596 TAI_THAM, 3597 3598 /** 3599 * Unicode script "Tai_Viet". 3600 */ 3601 TAI_VIET, 3602 3603 /** 3604 * Unicode script "Avestan". 3605 */ 3606 AVESTAN, 3607 3608 /** 3609 * Unicode script "Egyptian_Hieroglyphs". 3610 */ 3611 EGYPTIAN_HIEROGLYPHS, 3612 3613 /** 3614 * Unicode script "Samaritan". 3615 */ 3616 SAMARITAN, 3617 3618 /** 3619 * Unicode script "Mandaic". 3620 */ 3621 MANDAIC, 3622 3623 /** 3624 * Unicode script "Lisu". 3625 */ 3626 LISU, 3627 3628 /** 3629 * Unicode script "Bamum". 3630 */ 3631 BAMUM, 3632 3633 /** 3634 * Unicode script "Javanese". 3635 */ 3636 JAVANESE, 3637 3638 /** 3639 * Unicode script "Meetei_Mayek". 3640 */ 3641 MEETEI_MAYEK, 3642 3643 /** 3644 * Unicode script "Imperial_Aramaic". 3645 */ 3646 IMPERIAL_ARAMAIC, 3647 3648 /** 3649 * Unicode script "Old_South_Arabian". 3650 */ 3651 OLD_SOUTH_ARABIAN, 3652 3653 /** 3654 * Unicode script "Inscriptional_Parthian". 3655 */ 3656 INSCRIPTIONAL_PARTHIAN, 3657 3658 /** 3659 * Unicode script "Inscriptional_Pahlavi". 3660 */ 3661 INSCRIPTIONAL_PAHLAVI, 3662 3663 /** 3664 * Unicode script "Old_Turkic". 3665 */ 3666 OLD_TURKIC, 3667 3668 /** 3669 * Unicode script "Brahmi". 3670 */ 3671 BRAHMI, 3672 3673 /** 3674 * Unicode script "Kaithi". 3675 */ 3676 KAITHI, 3677 3678 /** 3679 * Unicode script "Meroitic Hieroglyphs". 3680 */ 3681 MEROITIC_HIEROGLYPHS, 3682 3683 /** 3684 * Unicode script "Meroitic Cursive". 3685 */ 3686 MEROITIC_CURSIVE, 3687 3688 /** 3689 * Unicode script "Sora Sompeng". 3690 */ 3691 SORA_SOMPENG, 3692 3693 /** 3694 * Unicode script "Chakma". 3695 */ 3696 CHAKMA, 3697 3698 /** 3699 * Unicode script "Sharada". 3700 */ 3701 SHARADA, 3702 3703 /** 3704 * Unicode script "Takri". 3705 */ 3706 TAKRI, 3707 3708 /** 3709 * Unicode script "Miao". 3710 */ 3711 MIAO, 3712 3713 /** 3714 * Unicode script "Unknown". 3715 */ 3716 UNKNOWN; 3717 3718 private static final int[] scriptStarts = { 3719 0x0000, // 0000..0040; COMMON 3720 0x0041, // 0041..005A; LATIN 3721 0x005B, // 005B..0060; COMMON 3722 0x0061, // 0061..007A; LATIN 3723 0x007B, // 007B..00A9; COMMON 3724 0x00AA, // 00AA..00AA; LATIN 3725 0x00AB, // 00AB..00B9; COMMON 3726 0x00BA, // 00BA..00BA; LATIN 3727 0x00BB, // 00BB..00BF; COMMON 3728 0x00C0, // 00C0..00D6; LATIN 3729 0x00D7, // 00D7..00D7; COMMON 3730 0x00D8, // 00D8..00F6; LATIN 3731 0x00F7, // 00F7..00F7; COMMON 3732 0x00F8, // 00F8..02B8; LATIN 3733 0x02B9, // 02B9..02DF; COMMON 3734 0x02E0, // 02E0..02E4; LATIN 3735 0x02E5, // 02E5..02E9; COMMON 3736 0x02EA, // 02EA..02EB; BOPOMOFO 3737 0x02EC, // 02EC..02FF; COMMON 3738 0x0300, // 0300..036F; INHERITED 3739 0x0370, // 0370..0373; GREEK 3740 0x0374, // 0374..0374; COMMON 3741 0x0375, // 0375..037D; GREEK 3742 0x037E, // 037E..0383; COMMON 3743 0x0384, // 0384..0384; GREEK 3744 0x0385, // 0385..0385; COMMON 3745 0x0386, // 0386..0386; GREEK 3746 0x0387, // 0387..0387; COMMON 3747 0x0388, // 0388..03E1; GREEK 3748 0x03E2, // 03E2..03EF; COPTIC 3749 0x03F0, // 03F0..03FF; GREEK 3750 0x0400, // 0400..0484; CYRILLIC 3751 0x0485, // 0485..0486; INHERITED 3752 0x0487, // 0487..0530; CYRILLIC 3753 0x0531, // 0531..0588; ARMENIAN 3754 0x0589, // 0589..0589; COMMON 3755 0x058A, // 058A..0590; ARMENIAN 3756 0x0591, // 0591..05FF; HEBREW 3757 0x0600, // 0600..060B; ARABIC 3758 0x060C, // 060C..060C; COMMON 3759 0x060D, // 060D..061A; ARABIC 3760 0x061B, // 061B..061D; COMMON 3761 0x061E, // 061E..061E; ARABIC 3762 0x061F, // 061F..061F; COMMON 3763 0x0620, // 0620..063F; ARABIC 3764 0x0640, // 0640..0640; COMMON 3765 0x0641, // 0641..064A; ARABIC 3766 0x064B, // 064B..0655; INHERITED 3767 0x0656, // 0656..065F; ARABIC 3768 0x0660, // 0660..0669; COMMON 3769 0x066A, // 066A..066F; ARABIC 3770 0x0670, // 0670..0670; INHERITED 3771 0x0671, // 0671..06DC; ARABIC 3772 0x06DD, // 06DD..06DD; COMMON 3773 0x06DE, // 06DE..06FF; ARABIC 3774 0x0700, // 0700..074F; SYRIAC 3775 0x0750, // 0750..077F; ARABIC 3776 0x0780, // 0780..07BF; THAANA 3777 0x07C0, // 07C0..07FF; NKO 3778 0x0800, // 0800..083F; SAMARITAN 3779 0x0840, // 0840..089F; MANDAIC 3780 0x08A0, // 08A0..08FF; ARABIC 3781 0x0900, // 0900..0950; DEVANAGARI 3782 0x0951, // 0951..0952; INHERITED 3783 0x0953, // 0953..0963; DEVANAGARI 3784 0x0964, // 0964..0965; COMMON 3785 0x0966, // 0966..0980; DEVANAGARI 3786 0x0981, // 0981..0A00; BENGALI 3787 0x0A01, // 0A01..0A80; GURMUKHI 3788 0x0A81, // 0A81..0B00; GUJARATI 3789 0x0B01, // 0B01..0B81; ORIYA 3790 0x0B82, // 0B82..0C00; TAMIL 3791 0x0C01, // 0C01..0C81; TELUGU 3792 0x0C82, // 0C82..0CF0; KANNADA 3793 0x0D02, // 0D02..0D81; MALAYALAM 3794 0x0D82, // 0D82..0E00; SINHALA 3795 0x0E01, // 0E01..0E3E; THAI 3796 0x0E3F, // 0E3F..0E3F; COMMON 3797 0x0E40, // 0E40..0E80; THAI 3798 0x0E81, // 0E81..0EFF; LAO 3799 0x0F00, // 0F00..0FD4; TIBETAN 3800 0x0FD5, // 0FD5..0FD8; COMMON 3801 0x0FD9, // 0FD9..0FFF; TIBETAN 3802 0x1000, // 1000..109F; MYANMAR 3803 0x10A0, // 10A0..10FA; GEORGIAN 3804 0x10FB, // 10FB..10FB; COMMON 3805 0x10FC, // 10FC..10FF; GEORGIAN 3806 0x1100, // 1100..11FF; HANGUL 3807 0x1200, // 1200..139F; ETHIOPIC 3808 0x13A0, // 13A0..13FF; CHEROKEE 3809 0x1400, // 1400..167F; CANADIAN_ABORIGINAL 3810 0x1680, // 1680..169F; OGHAM 3811 0x16A0, // 16A0..16EA; RUNIC 3812 0x16EB, // 16EB..16ED; COMMON 3813 0x16EE, // 16EE..16FF; RUNIC 3814 0x1700, // 1700..171F; TAGALOG 3815 0x1720, // 1720..1734; HANUNOO 3816 0x1735, // 1735..173F; COMMON 3817 0x1740, // 1740..175F; BUHID 3818 0x1760, // 1760..177F; TAGBANWA 3819 0x1780, // 1780..17FF; KHMER 3820 0x1800, // 1800..1801; MONGOLIAN 3821 0x1802, // 1802..1803; COMMON 3822 0x1804, // 1804..1804; MONGOLIAN 3823 0x1805, // 1805..1805; COMMON 3824 0x1806, // 1806..18AF; MONGOLIAN 3825 0x18B0, // 18B0..18FF; CANADIAN_ABORIGINAL 3826 0x1900, // 1900..194F; LIMBU 3827 0x1950, // 1950..197F; TAI_LE 3828 0x1980, // 1980..19DF; NEW_TAI_LUE 3829 0x19E0, // 19E0..19FF; KHMER 3830 0x1A00, // 1A00..1A1F; BUGINESE 3831 0x1A20, // 1A20..1AFF; TAI_THAM 3832 0x1B00, // 1B00..1B7F; BALINESE 3833 0x1B80, // 1B80..1BBF; SUNDANESE 3834 0x1BC0, // 1BC0..1BFF; BATAK 3835 0x1C00, // 1C00..1C4F; LEPCHA 3836 0x1C50, // 1C50..1CBF; OL_CHIKI 3837 0x1CC0, // 1CC0..1CCF; SUNDANESE 3838 0x1CD0, // 1CD0..1CD2; INHERITED 3839 0x1CD3, // 1CD3..1CD3; COMMON 3840 0x1CD4, // 1CD4..1CE0; INHERITED 3841 0x1CE1, // 1CE1..1CE1; COMMON 3842 0x1CE2, // 1CE2..1CE8; INHERITED 3843 0x1CE9, // 1CE9..1CEC; COMMON 3844 0x1CED, // 1CED..1CED; INHERITED 3845 0x1CEE, // 1CEE..1CF3; COMMON 3846 0x1CF4, // 1CF4..1CF4; INHERITED 3847 0x1CF5, // 1CF5..1CFF; COMMON 3848 0x1D00, // 1D00..1D25; LATIN 3849 0x1D26, // 1D26..1D2A; GREEK 3850 0x1D2B, // 1D2B..1D2B; CYRILLIC 3851 0x1D2C, // 1D2C..1D5C; LATIN 3852 0x1D5D, // 1D5D..1D61; GREEK 3853 0x1D62, // 1D62..1D65; LATIN 3854 0x1D66, // 1D66..1D6A; GREEK 3855 0x1D6B, // 1D6B..1D77; LATIN 3856 0x1D78, // 1D78..1D78; CYRILLIC 3857 0x1D79, // 1D79..1DBE; LATIN 3858 0x1DBF, // 1DBF..1DBF; GREEK 3859 0x1DC0, // 1DC0..1DFF; INHERITED 3860 0x1E00, // 1E00..1EFF; LATIN 3861 0x1F00, // 1F00..1FFF; GREEK 3862 0x2000, // 2000..200B; COMMON 3863 0x200C, // 200C..200D; INHERITED 3864 0x200E, // 200E..2070; COMMON 3865 0x2071, // 2071..2073; LATIN 3866 0x2074, // 2074..207E; COMMON 3867 0x207F, // 207F..207F; LATIN 3868 0x2080, // 2080..208F; COMMON 3869 0x2090, // 2090..209F; LATIN 3870 0x20A0, // 20A0..20CF; COMMON 3871 0x20D0, // 20D0..20FF; INHERITED 3872 0x2100, // 2100..2125; COMMON 3873 0x2126, // 2126..2126; GREEK 3874 0x2127, // 2127..2129; COMMON 3875 0x212A, // 212A..212B; LATIN 3876 0x212C, // 212C..2131; COMMON 3877 0x2132, // 2132..2132; LATIN 3878 0x2133, // 2133..214D; COMMON 3879 0x214E, // 214E..214E; LATIN 3880 0x214F, // 214F..215F; COMMON 3881 0x2160, // 2160..2188; LATIN 3882 0x2189, // 2189..27FF; COMMON 3883 0x2800, // 2800..28FF; BRAILLE 3884 0x2900, // 2900..2BFF; COMMON 3885 0x2C00, // 2C00..2C5F; GLAGOLITIC 3886 0x2C60, // 2C60..2C7F; LATIN 3887 0x2C80, // 2C80..2CFF; COPTIC 3888 0x2D00, // 2D00..2D2F; GEORGIAN 3889 0x2D30, // 2D30..2D7F; TIFINAGH 3890 0x2D80, // 2D80..2DDF; ETHIOPIC 3891 0x2DE0, // 2DE0..2DFF; CYRILLIC 3892 0x2E00, // 2E00..2E7F; COMMON 3893 0x2E80, // 2E80..2FEF; HAN 3894 0x2FF0, // 2FF0..3004; COMMON 3895 0x3005, // 3005..3005; HAN 3896 0x3006, // 3006..3006; COMMON 3897 0x3007, // 3007..3007; HAN 3898 0x3008, // 3008..3020; COMMON 3899 0x3021, // 3021..3029; HAN 3900 0x302A, // 302A..302D; INHERITED 3901 0x302E, // 302E..302F; HANGUL 3902 0x3030, // 3030..3037; COMMON 3903 0x3038, // 3038..303B; HAN 3904 0x303C, // 303C..3040; COMMON 3905 0x3041, // 3041..3098; HIRAGANA 3906 0x3099, // 3099..309A; INHERITED 3907 0x309B, // 309B..309C; COMMON 3908 0x309D, // 309D..309F; HIRAGANA 3909 0x30A0, // 30A0..30A0; COMMON 3910 0x30A1, // 30A1..30FA; KATAKANA 3911 0x30FB, // 30FB..30FC; COMMON 3912 0x30FD, // 30FD..3104; KATAKANA 3913 0x3105, // 3105..3130; BOPOMOFO 3914 0x3131, // 3131..318F; HANGUL 3915 0x3190, // 3190..319F; COMMON 3916 0x31A0, // 31A0..31BF; BOPOMOFO 3917 0x31C0, // 31C0..31EF; COMMON 3918 0x31F0, // 31F0..31FF; KATAKANA 3919 0x3200, // 3200..321F; HANGUL 3920 0x3220, // 3220..325F; COMMON 3921 0x3260, // 3260..327E; HANGUL 3922 0x327F, // 327F..32CF; COMMON 3923 0x32D0, // 32D0..3357; KATAKANA 3924 0x3358, // 3358..33FF; COMMON 3925 0x3400, // 3400..4DBF; HAN 3926 0x4DC0, // 4DC0..4DFF; COMMON 3927 0x4E00, // 4E00..9FFF; HAN 3928 0xA000, // A000..A4CF; YI 3929 0xA4D0, // A4D0..A4FF; LISU 3930 0xA500, // A500..A63F; VAI 3931 0xA640, // A640..A69F; CYRILLIC 3932 0xA6A0, // A6A0..A6FF; BAMUM 3933 0xA700, // A700..A721; COMMON 3934 0xA722, // A722..A787; LATIN 3935 0xA788, // A788..A78A; COMMON 3936 0xA78B, // A78B..A7FF; LATIN 3937 0xA800, // A800..A82F; SYLOTI_NAGRI 3938 0xA830, // A830..A83F; COMMON 3939 0xA840, // A840..A87F; PHAGS_PA 3940 0xA880, // A880..A8DF; SAURASHTRA 3941 0xA8E0, // A8E0..A8FF; DEVANAGARI 3942 0xA900, // A900..A92F; KAYAH_LI 3943 0xA930, // A930..A95F; REJANG 3944 0xA960, // A960..A97F; HANGUL 3945 0xA980, // A980..A9FF; JAVANESE 3946 0xAA00, // AA00..AA5F; CHAM 3947 0xAA60, // AA60..AA7F; MYANMAR 3948 0xAA80, // AA80..AADF; TAI_VIET 3949 0xAAE0, // AAE0..AB00; MEETEI_MAYEK 3950 0xAB01, // AB01..ABBF; ETHIOPIC 3951 0xABC0, // ABC0..ABFF; MEETEI_MAYEK 3952 0xAC00, // AC00..D7FB; HANGUL 3953 0xD7FC, // D7FC..F8FF; UNKNOWN 3954 0xF900, // F900..FAFF; HAN 3955 0xFB00, // FB00..FB12; LATIN 3956 0xFB13, // FB13..FB1C; ARMENIAN 3957 0xFB1D, // FB1D..FB4F; HEBREW 3958 0xFB50, // FB50..FD3D; ARABIC 3959 0xFD3E, // FD3E..FD4F; COMMON 3960 0xFD50, // FD50..FDFC; ARABIC 3961 0xFDFD, // FDFD..FDFF; COMMON 3962 0xFE00, // FE00..FE0F; INHERITED 3963 0xFE10, // FE10..FE1F; COMMON 3964 0xFE20, // FE20..FE2F; INHERITED 3965 0xFE30, // FE30..FE6F; COMMON 3966 0xFE70, // FE70..FEFE; ARABIC 3967 0xFEFF, // FEFF..FF20; COMMON 3968 0xFF21, // FF21..FF3A; LATIN 3969 0xFF3B, // FF3B..FF40; COMMON 3970 0xFF41, // FF41..FF5A; LATIN 3971 0xFF5B, // FF5B..FF65; COMMON 3972 0xFF66, // FF66..FF6F; KATAKANA 3973 0xFF70, // FF70..FF70; COMMON 3974 0xFF71, // FF71..FF9D; KATAKANA 3975 0xFF9E, // FF9E..FF9F; COMMON 3976 0xFFA0, // FFA0..FFDF; HANGUL 3977 0xFFE0, // FFE0..FFFF; COMMON 3978 0x10000, // 10000..100FF; LINEAR_B 3979 0x10100, // 10100..1013F; COMMON 3980 0x10140, // 10140..1018F; GREEK 3981 0x10190, // 10190..101FC; COMMON 3982 0x101FD, // 101FD..1027F; INHERITED 3983 0x10280, // 10280..1029F; LYCIAN 3984 0x102A0, // 102A0..102FF; CARIAN 3985 0x10300, // 10300..1032F; OLD_ITALIC 3986 0x10330, // 10330..1037F; GOTHIC 3987 0x10380, // 10380..1039F; UGARITIC 3988 0x103A0, // 103A0..103FF; OLD_PERSIAN 3989 0x10400, // 10400..1044F; DESERET 3990 0x10450, // 10450..1047F; SHAVIAN 3991 0x10480, // 10480..107FF; OSMANYA 3992 0x10800, // 10800..1083F; CYPRIOT 3993 0x10840, // 10840..108FF; IMPERIAL_ARAMAIC 3994 0x10900, // 10900..1091F; PHOENICIAN 3995 0x10920, // 10920..1097F; LYDIAN 3996 0x10980, // 10980..1099F; MEROITIC_HIEROGLYPHS 3997 0x109A0, // 109A0..109FF; MEROITIC_CURSIVE 3998 0x10A00, // 10A00..10A5F; KHAROSHTHI 3999 0x10A60, // 10A60..10AFF; OLD_SOUTH_ARABIAN 4000 0x10B00, // 10B00..10B3F; AVESTAN 4001 0x10B40, // 10B40..10B5F; INSCRIPTIONAL_PARTHIAN 4002 0x10B60, // 10B60..10BFF; INSCRIPTIONAL_PAHLAVI 4003 0x10C00, // 10C00..10E5F; OLD_TURKIC 4004 0x10E60, // 10E60..10FFF; ARABIC 4005 0x11000, // 11000..1107F; BRAHMI 4006 0x11080, // 11080..110CF; KAITHI 4007 0x110D0, // 110D0..110FF; SORA_SOMPENG 4008 0x11100, // 11100..1117F; CHAKMA 4009 0x11180, // 11180..1167F; SHARADA 4010 0x11680, // 11680..116CF; TAKRI 4011 0x12000, // 12000..12FFF; CUNEIFORM 4012 0x13000, // 13000..167FF; EGYPTIAN_HIEROGLYPHS 4013 0x16800, // 16800..16A38; BAMUM 4014 0x16F00, // 16F00..16F9F; MIAO 4015 0x1B000, // 1B000..1B000; KATAKANA 4016 0x1B001, // 1B001..1CFFF; HIRAGANA 4017 0x1D000, // 1D000..1D166; COMMON 4018 0x1D167, // 1D167..1D169; INHERITED 4019 0x1D16A, // 1D16A..1D17A; COMMON 4020 0x1D17B, // 1D17B..1D182; INHERITED 4021 0x1D183, // 1D183..1D184; COMMON 4022 0x1D185, // 1D185..1D18B; INHERITED 4023 0x1D18C, // 1D18C..1D1A9; COMMON 4024 0x1D1AA, // 1D1AA..1D1AD; INHERITED 4025 0x1D1AE, // 1D1AE..1D1FF; COMMON 4026 0x1D200, // 1D200..1D2FF; GREEK 4027 0x1D300, // 1D300..1EDFF; COMMON 4028 0x1EE00, // 1EE00..1EFFF; ARABIC 4029 0x1F000, // 1F000..1F1FF; COMMON 4030 0x1F200, // 1F200..1F200; HIRAGANA 4031 0x1F201, // 1F210..1FFFF; COMMON 4032 0x20000, // 20000..E0000; HAN 4033 0xE0001, // E0001..E00FF; COMMON 4034 0xE0100, // E0100..E01EF; INHERITED 4035 0xE01F0 // E01F0..10FFFF; UNKNOWN 4036 4037 }; 4038 4039 private static final UnicodeScript[] scripts = { 4040 COMMON, 4041 LATIN, 4042 COMMON, 4043 LATIN, 4044 COMMON, 4045 LATIN, 4046 COMMON, 4047 LATIN, 4048 COMMON, 4049 LATIN, 4050 COMMON, 4051 LATIN, 4052 COMMON, 4053 LATIN, 4054 COMMON, 4055 LATIN, 4056 COMMON, 4057 BOPOMOFO, 4058 COMMON, 4059 INHERITED, 4060 GREEK, 4061 COMMON, 4062 GREEK, 4063 COMMON, 4064 GREEK, 4065 COMMON, 4066 GREEK, 4067 COMMON, 4068 GREEK, 4069 COPTIC, 4070 GREEK, 4071 CYRILLIC, 4072 INHERITED, 4073 CYRILLIC, 4074 ARMENIAN, 4075 COMMON, 4076 ARMENIAN, 4077 HEBREW, 4078 ARABIC, 4079 COMMON, 4080 ARABIC, 4081 COMMON, 4082 ARABIC, 4083 COMMON, 4084 ARABIC, 4085 COMMON, 4086 ARABIC, 4087 INHERITED, 4088 ARABIC, 4089 COMMON, 4090 ARABIC, 4091 INHERITED, 4092 ARABIC, 4093 COMMON, 4094 ARABIC, 4095 SYRIAC, 4096 ARABIC, 4097 THAANA, 4098 NKO, 4099 SAMARITAN, 4100 MANDAIC, 4101 ARABIC, 4102 DEVANAGARI, 4103 INHERITED, 4104 DEVANAGARI, 4105 COMMON, 4106 DEVANAGARI, 4107 BENGALI, 4108 GURMUKHI, 4109 GUJARATI, 4110 ORIYA, 4111 TAMIL, 4112 TELUGU, 4113 KANNADA, 4114 MALAYALAM, 4115 SINHALA, 4116 THAI, 4117 COMMON, 4118 THAI, 4119 LAO, 4120 TIBETAN, 4121 COMMON, 4122 TIBETAN, 4123 MYANMAR, 4124 GEORGIAN, 4125 COMMON, 4126 GEORGIAN, 4127 HANGUL, 4128 ETHIOPIC, 4129 CHEROKEE, 4130 CANADIAN_ABORIGINAL, 4131 OGHAM, 4132 RUNIC, 4133 COMMON, 4134 RUNIC, 4135 TAGALOG, 4136 HANUNOO, 4137 COMMON, 4138 BUHID, 4139 TAGBANWA, 4140 KHMER, 4141 MONGOLIAN, 4142 COMMON, 4143 MONGOLIAN, 4144 COMMON, 4145 MONGOLIAN, 4146 CANADIAN_ABORIGINAL, 4147 LIMBU, 4148 TAI_LE, 4149 NEW_TAI_LUE, 4150 KHMER, 4151 BUGINESE, 4152 TAI_THAM, 4153 BALINESE, 4154 SUNDANESE, 4155 BATAK, 4156 LEPCHA, 4157 OL_CHIKI, 4158 SUNDANESE, 4159 INHERITED, 4160 COMMON, 4161 INHERITED, 4162 COMMON, 4163 INHERITED, 4164 COMMON, 4165 INHERITED, 4166 COMMON, 4167 INHERITED, 4168 COMMON, 4169 LATIN, 4170 GREEK, 4171 CYRILLIC, 4172 LATIN, 4173 GREEK, 4174 LATIN, 4175 GREEK, 4176 LATIN, 4177 CYRILLIC, 4178 LATIN, 4179 GREEK, 4180 INHERITED, 4181 LATIN, 4182 GREEK, 4183 COMMON, 4184 INHERITED, 4185 COMMON, 4186 LATIN, 4187 COMMON, 4188 LATIN, 4189 COMMON, 4190 LATIN, 4191 COMMON, 4192 INHERITED, 4193 COMMON, 4194 GREEK, 4195 COMMON, 4196 LATIN, 4197 COMMON, 4198 LATIN, 4199 COMMON, 4200 LATIN, 4201 COMMON, 4202 LATIN, 4203 COMMON, 4204 BRAILLE, 4205 COMMON, 4206 GLAGOLITIC, 4207 LATIN, 4208 COPTIC, 4209 GEORGIAN, 4210 TIFINAGH, 4211 ETHIOPIC, 4212 CYRILLIC, 4213 COMMON, 4214 HAN, 4215 COMMON, 4216 HAN, 4217 COMMON, 4218 HAN, 4219 COMMON, 4220 HAN, 4221 INHERITED, 4222 HANGUL, 4223 COMMON, 4224 HAN, 4225 COMMON, 4226 HIRAGANA, 4227 INHERITED, 4228 COMMON, 4229 HIRAGANA, 4230 COMMON, 4231 KATAKANA, 4232 COMMON, 4233 KATAKANA, 4234 BOPOMOFO, 4235 HANGUL, 4236 COMMON, 4237 BOPOMOFO, 4238 COMMON, 4239 KATAKANA, 4240 HANGUL, 4241 COMMON, 4242 HANGUL, 4243 COMMON, 4244 KATAKANA, 4245 COMMON, 4246 HAN, 4247 COMMON, 4248 HAN, 4249 YI, 4250 LISU, 4251 VAI, 4252 CYRILLIC, 4253 BAMUM, 4254 COMMON, 4255 LATIN, 4256 COMMON, 4257 LATIN, 4258 SYLOTI_NAGRI, 4259 COMMON, 4260 PHAGS_PA, 4261 SAURASHTRA, 4262 DEVANAGARI, 4263 KAYAH_LI, 4264 REJANG, 4265 HANGUL, 4266 JAVANESE, 4267 CHAM, 4268 MYANMAR, 4269 TAI_VIET, 4270 MEETEI_MAYEK, 4271 ETHIOPIC, 4272 MEETEI_MAYEK, 4273 HANGUL, 4274 UNKNOWN , 4275 HAN, 4276 LATIN, 4277 ARMENIAN, 4278 HEBREW, 4279 ARABIC, 4280 COMMON, 4281 ARABIC, 4282 COMMON, 4283 INHERITED, 4284 COMMON, 4285 INHERITED, 4286 COMMON, 4287 ARABIC, 4288 COMMON, 4289 LATIN, 4290 COMMON, 4291 LATIN, 4292 COMMON, 4293 KATAKANA, 4294 COMMON, 4295 KATAKANA, 4296 COMMON, 4297 HANGUL, 4298 COMMON, 4299 LINEAR_B, 4300 COMMON, 4301 GREEK, 4302 COMMON, 4303 INHERITED, 4304 LYCIAN, 4305 CARIAN, 4306 OLD_ITALIC, 4307 GOTHIC, 4308 UGARITIC, 4309 OLD_PERSIAN, 4310 DESERET, 4311 SHAVIAN, 4312 OSMANYA, 4313 CYPRIOT, 4314 IMPERIAL_ARAMAIC, 4315 PHOENICIAN, 4316 LYDIAN, 4317 MEROITIC_HIEROGLYPHS, 4318 MEROITIC_CURSIVE, 4319 KHAROSHTHI, 4320 OLD_SOUTH_ARABIAN, 4321 AVESTAN, 4322 INSCRIPTIONAL_PARTHIAN, 4323 INSCRIPTIONAL_PAHLAVI, 4324 OLD_TURKIC, 4325 ARABIC, 4326 BRAHMI, 4327 KAITHI, 4328 SORA_SOMPENG, 4329 CHAKMA, 4330 SHARADA, 4331 TAKRI, 4332 CUNEIFORM, 4333 EGYPTIAN_HIEROGLYPHS, 4334 BAMUM, 4335 MIAO, 4336 KATAKANA, 4337 HIRAGANA, 4338 COMMON, 4339 INHERITED, 4340 COMMON, 4341 INHERITED, 4342 COMMON, 4343 INHERITED, 4344 COMMON, 4345 INHERITED, 4346 COMMON, 4347 GREEK, 4348 COMMON, 4349 ARABIC, 4350 COMMON, 4351 HIRAGANA, 4352 COMMON, 4353 HAN, 4354 COMMON, 4355 INHERITED, 4356 UNKNOWN 4357 }; 4358 4359 private static HashMap<String, Character.UnicodeScript> aliases; 4360 static { 4361 aliases = new HashMap<>(128); 4362 aliases.put("ARAB", ARABIC); 4363 aliases.put("ARMI", IMPERIAL_ARAMAIC); 4364 aliases.put("ARMN", ARMENIAN); 4365 aliases.put("AVST", AVESTAN); 4366 aliases.put("BALI", BALINESE); 4367 aliases.put("BAMU", BAMUM); 4368 aliases.put("BATK", BATAK); 4369 aliases.put("BENG", BENGALI); 4370 aliases.put("BOPO", BOPOMOFO); 4371 aliases.put("BRAI", BRAILLE); 4372 aliases.put("BRAH", BRAHMI); 4373 aliases.put("BUGI", BUGINESE); 4374 aliases.put("BUHD", BUHID); 4375 aliases.put("CAKM", CHAKMA); 4376 aliases.put("CANS", CANADIAN_ABORIGINAL); 4377 aliases.put("CARI", CARIAN); 4378 aliases.put("CHAM", CHAM); 4379 aliases.put("CHER", CHEROKEE); 4380 aliases.put("COPT", COPTIC); 4381 aliases.put("CPRT", CYPRIOT); 4382 aliases.put("CYRL", CYRILLIC); 4383 aliases.put("DEVA", DEVANAGARI); 4384 aliases.put("DSRT", DESERET); 4385 aliases.put("EGYP", EGYPTIAN_HIEROGLYPHS); 4386 aliases.put("ETHI", ETHIOPIC); 4387 aliases.put("GEOR", GEORGIAN); 4388 aliases.put("GLAG", GLAGOLITIC); 4389 aliases.put("GOTH", GOTHIC); 4390 aliases.put("GREK", GREEK); 4391 aliases.put("GUJR", GUJARATI); 4392 aliases.put("GURU", GURMUKHI); 4393 aliases.put("HANG", HANGUL); 4394 aliases.put("HANI", HAN); 4395 aliases.put("HANO", HANUNOO); 4396 aliases.put("HEBR", HEBREW); 4397 aliases.put("HIRA", HIRAGANA); 4398 // it appears we don't have the KATAKANA_OR_HIRAGANA 4399 //aliases.put("HRKT", KATAKANA_OR_HIRAGANA); 4400 aliases.put("ITAL", OLD_ITALIC); 4401 aliases.put("JAVA", JAVANESE); 4402 aliases.put("KALI", KAYAH_LI); 4403 aliases.put("KANA", KATAKANA); 4404 aliases.put("KHAR", KHAROSHTHI); 4405 aliases.put("KHMR", KHMER); 4406 aliases.put("KNDA", KANNADA); 4407 aliases.put("KTHI", KAITHI); 4408 aliases.put("LANA", TAI_THAM); 4409 aliases.put("LAOO", LAO); 4410 aliases.put("LATN", LATIN); 4411 aliases.put("LEPC", LEPCHA); 4412 aliases.put("LIMB", LIMBU); 4413 aliases.put("LINB", LINEAR_B); 4414 aliases.put("LISU", LISU); 4415 aliases.put("LYCI", LYCIAN); 4416 aliases.put("LYDI", LYDIAN); 4417 aliases.put("MAND", MANDAIC); 4418 aliases.put("MERC", MEROITIC_CURSIVE); 4419 aliases.put("MERO", MEROITIC_HIEROGLYPHS); 4420 aliases.put("MLYM", MALAYALAM); 4421 aliases.put("MONG", MONGOLIAN); 4422 aliases.put("MTEI", MEETEI_MAYEK); 4423 aliases.put("MYMR", MYANMAR); 4424 aliases.put("NKOO", NKO); 4425 aliases.put("OGAM", OGHAM); 4426 aliases.put("OLCK", OL_CHIKI); 4427 aliases.put("ORKH", OLD_TURKIC); 4428 aliases.put("ORYA", ORIYA); 4429 aliases.put("OSMA", OSMANYA); 4430 aliases.put("PHAG", PHAGS_PA); 4431 aliases.put("PLRD", MIAO); 4432 aliases.put("PHLI", INSCRIPTIONAL_PAHLAVI); 4433 aliases.put("PHNX", PHOENICIAN); 4434 aliases.put("PRTI", INSCRIPTIONAL_PARTHIAN); 4435 aliases.put("RJNG", REJANG); 4436 aliases.put("RUNR", RUNIC); 4437 aliases.put("SAMR", SAMARITAN); 4438 aliases.put("SARB", OLD_SOUTH_ARABIAN); 4439 aliases.put("SAUR", SAURASHTRA); 4440 aliases.put("SHAW", SHAVIAN); 4441 aliases.put("SHRD", SHARADA); 4442 aliases.put("SINH", SINHALA); 4443 aliases.put("SORA", SORA_SOMPENG); 4444 aliases.put("SUND", SUNDANESE); 4445 aliases.put("SYLO", SYLOTI_NAGRI); 4446 aliases.put("SYRC", SYRIAC); 4447 aliases.put("TAGB", TAGBANWA); 4448 aliases.put("TALE", TAI_LE); 4449 aliases.put("TAKR", TAKRI); 4450 aliases.put("TALU", NEW_TAI_LUE); 4451 aliases.put("TAML", TAMIL); 4452 aliases.put("TAVT", TAI_VIET); 4453 aliases.put("TELU", TELUGU); 4454 aliases.put("TFNG", TIFINAGH); 4455 aliases.put("TGLG", TAGALOG); 4456 aliases.put("THAA", THAANA); 4457 aliases.put("THAI", THAI); 4458 aliases.put("TIBT", TIBETAN); 4459 aliases.put("UGAR", UGARITIC); 4460 aliases.put("VAII", VAI); 4461 aliases.put("XPEO", OLD_PERSIAN); 4462 aliases.put("XSUX", CUNEIFORM); 4463 aliases.put("YIII", YI); 4464 aliases.put("ZINH", INHERITED); 4465 aliases.put("ZYYY", COMMON); 4466 aliases.put("ZZZZ", UNKNOWN); 4467 } 4468 4469 /** 4470 * Returns the enum constant representing the Unicode script of which 4471 * the given character (Unicode code point) is assigned to. 4472 * 4473 * @param codePoint the character (Unicode code point) in question. 4474 * @return The {@code UnicodeScript} constant representing the 4475 * Unicode script of which this character is assigned to. 4476 * 4477 * @exception IllegalArgumentException if the specified 4478 * {@code codePoint} is an invalid Unicode code point. 4479 * @see Character#isValidCodePoint(int) 4480 * 4481 */ 4482 public static UnicodeScript of(int codePoint) { 4483 if (!isValidCodePoint(codePoint)) 4484 throw new IllegalArgumentException(); 4485 int type = getType(codePoint); 4486 // leave SURROGATE and PRIVATE_USE for table lookup 4487 if (type == UNASSIGNED) 4488 return UNKNOWN; 4489 int index = Arrays.binarySearch(scriptStarts, codePoint); 4490 if (index < 0) 4491 index = -index - 2; 4492 return scripts[index]; 4493 } 4494 4495 /** 4496 * Returns the UnicodeScript constant with the given Unicode script 4497 * name or the script name alias. Script names and their aliases are 4498 * determined by The Unicode Standard. The files Scripts<version>.txt 4499 * and PropertyValueAliases<version>.txt define script names 4500 * and the script name aliases for a particular version of the 4501 * standard. The {@link Character} class specifies the version of 4502 * the standard that it supports. 4503 * <p> 4504 * Character case is ignored for all of the valid script names. 4505 * The en_US locale's case mapping rules are used to provide 4506 * case-insensitive string comparisons for script name validation. 4507 * 4508 * @param scriptName A {@code UnicodeScript} name. 4509 * @return The {@code UnicodeScript} constant identified 4510 * by {@code scriptName} 4511 * @throws IllegalArgumentException if {@code scriptName} is an 4512 * invalid name 4513 * @throws NullPointerException if {@code scriptName} is null 4514 */ 4515 public static final UnicodeScript forName(String scriptName) { 4516 scriptName = scriptName.toUpperCase(Locale.ENGLISH); 4517 //.replace(' ', '_')); 4518 UnicodeScript sc = aliases.get(scriptName); 4519 if (sc != null) 4520 return sc; 4521 return valueOf(scriptName); 4522 } 4523 } 4524 4525 /** 4526 * The value of the {@code Character}. 4527 * 4528 * @serial 4529 */ 4530 private final char value; 4531 4532 /** use serialVersionUID from JDK 1.0.2 for interoperability */ 4533 private static final long serialVersionUID = 3786198910865385080L; 4534 4535 /** 4536 * Constructs a newly allocated {@code Character} object that 4537 * represents the specified {@code char} value. 4538 * 4539 * @param value the value to be represented by the 4540 * {@code Character} object. 4541 */ 4542 public Character(char value) { 4543 this.value = value; 4544 } 4545 4546 private static class CharacterCache { 4547 private CharacterCache(){} 4548 4549 static final Character cache[] = new Character[127 + 1]; 4550 4551 static { 4552 for (int i = 0; i < cache.length; i++) 4553 cache[i] = new Character((char)i); 4554 } 4555 } 4556 4557 /** 4558 * Returns a <tt>Character</tt> instance representing the specified 4559 * <tt>char</tt> value. 4560 * If a new <tt>Character</tt> instance is not required, this method 4561 * should generally be used in preference to the constructor 4562 * {@link #Character(char)}, as this method is likely to yield 4563 * significantly better space and time performance by caching 4564 * frequently requested values. 4565 * 4566 * This method will always cache values in the range {@code 4567 * '\u005Cu0000'} to {@code '\u005Cu007F'}, inclusive, and may 4568 * cache other values outside of this range. 4569 * 4570 * @param c a char value. 4571 * @return a <tt>Character</tt> instance representing <tt>c</tt>. 4572 * @since 1.5 4573 */ 4574 public static Character valueOf(char c) { 4575 if (c <= 127) { // must cache 4576 return CharacterCache.cache[(int)c]; 4577 } 4578 return new Character(c); 4579 } 4580 4581 /** 4582 * Returns the value of this {@code Character} object. 4583 * @return the primitive {@code char} value represented by 4584 * this object. 4585 */ 4586 public char charValue() { 4587 return value; 4588 } 4589 4590 /** 4591 * Returns a hash code for this {@code Character}; equal to the result 4592 * of invoking {@code charValue()}. 4593 * 4594 * @return a hash code value for this {@code Character} 4595 */ 4596 @Override 4597 public int hashCode() { 4598 return Character.hashCode(value); 4599 } 4600 4601 /** 4602 * Returns a hash code for a {@code char} value; compatible with 4603 * {@code Character.hashCode()}. 4604 * 4605 * @since 1.8 4606 * 4607 * @param value The {@code char} for which to return a hash code. 4608 * @return a hash code value for a {@code char} value. 4609 */ 4610 public static int hashCode(char value) { 4611 return (int)value; 4612 } 4613 4614 /** 4615 * Compares this object against the specified object. 4616 * The result is {@code true} if and only if the argument is not 4617 * {@code null} and is a {@code Character} object that 4618 * represents the same {@code char} value as this object. 4619 * 4620 * @param obj the object to compare with. 4621 * @return {@code true} if the objects are the same; 4622 * {@code false} otherwise. 4623 */ 4624 public boolean equals(Object obj) { 4625 if (obj instanceof Character) { 4626 return value == ((Character)obj).charValue(); 4627 } 4628 return false; 4629 } 4630 4631 /** 4632 * Returns a {@code String} object representing this 4633 * {@code Character}'s value. The result is a string of 4634 * length 1 whose sole component is the primitive 4635 * {@code char} value represented by this 4636 * {@code Character} object. 4637 * 4638 * @return a string representation of this object. 4639 */ 4640 public String toString() { 4641 char buf[] = {value}; 4642 return String.valueOf(buf); 4643 } 4644 4645 /** 4646 * Returns a {@code String} object representing the 4647 * specified {@code char}. The result is a string of length 4648 * 1 consisting solely of the specified {@code char}. 4649 * 4650 * @param c the {@code char} to be converted 4651 * @return the string representation of the specified {@code char} 4652 * @since 1.4 4653 */ 4654 public static String toString(char c) { 4655 return String.valueOf(c); 4656 } 4657 4658 /** 4659 * Determines whether the specified code point is a valid 4660 * <a href="http://www.unicode.org/glossary/#code_point"> 4661 * Unicode code point value</a>. 4662 * 4663 * @param codePoint the Unicode code point to be tested 4664 * @return {@code true} if the specified code point value is between 4665 * {@link #MIN_CODE_POINT} and 4666 * {@link #MAX_CODE_POINT} inclusive; 4667 * {@code false} otherwise. 4668 * @since 1.5 4669 */ 4670 public static boolean isValidCodePoint(int codePoint) { 4671 // Optimized form of: 4672 // codePoint >= MIN_CODE_POINT && codePoint <= MAX_CODE_POINT 4673 int plane = codePoint >>> 16; 4674 return plane < ((MAX_CODE_POINT + 1) >>> 16); 4675 } 4676 4677 /** 4678 * Determines whether the specified character (Unicode code point) 4679 * is in the <a href="#BMP">Basic Multilingual Plane (BMP)</a>. 4680 * Such code points can be represented using a single {@code char}. 4681 * 4682 * @param codePoint the character (Unicode code point) to be tested 4683 * @return {@code true} if the specified code point is between 4684 * {@link #MIN_VALUE} and {@link #MAX_VALUE} inclusive; 4685 * {@code false} otherwise. 4686 * @since 1.7 4687 */ 4688 public static boolean isBmpCodePoint(int codePoint) { 4689 return codePoint >>> 16 == 0; 4690 // Optimized form of: 4691 // codePoint >= MIN_VALUE && codePoint <= MAX_VALUE 4692 // We consistently use logical shift (>>>) to facilitate 4693 // additional runtime optimizations. 4694 } 4695 4696 /** 4697 * Determines whether the specified character (Unicode code point) 4698 * is in the <a href="#supplementary">supplementary character</a> range. 4699 * 4700 * @param codePoint the character (Unicode code point) to be tested 4701 * @return {@code true} if the specified code point is between 4702 * {@link #MIN_SUPPLEMENTARY_CODE_POINT} and 4703 * {@link #MAX_CODE_POINT} inclusive; 4704 * {@code false} otherwise. 4705 * @since 1.5 4706 */ 4707 public static boolean isSupplementaryCodePoint(int codePoint) { 4708 return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT 4709 && codePoint < MAX_CODE_POINT + 1; 4710 } 4711 4712 /** 4713 * Determines if the given {@code char} value is a 4714 * <a href="http://www.unicode.org/glossary/#high_surrogate_code_unit"> 4715 * Unicode high-surrogate code unit</a> 4716 * (also known as <i>leading-surrogate code unit</i>). 4717 * 4718 * <p>Such values do not represent characters by themselves, 4719 * but are used in the representation of 4720 * <a href="#supplementary">supplementary characters</a> 4721 * in the UTF-16 encoding. 4722 * 4723 * @param ch the {@code char} value to be tested. 4724 * @return {@code true} if the {@code char} value is between 4725 * {@link #MIN_HIGH_SURROGATE} and 4726 * {@link #MAX_HIGH_SURROGATE} inclusive; 4727 * {@code false} otherwise. 4728 * @see Character#isLowSurrogate(char) 4729 * @see Character.UnicodeBlock#of(int) 4730 * @since 1.5 4731 */ 4732 public static boolean isHighSurrogate(char ch) { 4733 // Help VM constant-fold; MAX_HIGH_SURROGATE + 1 == MIN_LOW_SURROGATE 4734 return ch >= MIN_HIGH_SURROGATE && ch < (MAX_HIGH_SURROGATE + 1); 4735 } 4736 4737 /** 4738 * Determines if the given {@code char} value is a 4739 * <a href="http://www.unicode.org/glossary/#low_surrogate_code_unit"> 4740 * Unicode low-surrogate code unit</a> 4741 * (also known as <i>trailing-surrogate code unit</i>). 4742 * 4743 * <p>Such values do not represent characters by themselves, 4744 * but are used in the representation of 4745 * <a href="#supplementary">supplementary characters</a> 4746 * in the UTF-16 encoding. 4747 * 4748 * @param ch the {@code char} value to be tested. 4749 * @return {@code true} if the {@code char} value is between 4750 * {@link #MIN_LOW_SURROGATE} and 4751 * {@link #MAX_LOW_SURROGATE} inclusive; 4752 * {@code false} otherwise. 4753 * @see Character#isHighSurrogate(char) 4754 * @since 1.5 4755 */ 4756 public static boolean isLowSurrogate(char ch) { 4757 return ch >= MIN_LOW_SURROGATE && ch < (MAX_LOW_SURROGATE + 1); 4758 } 4759 4760 /** 4761 * Determines if the given {@code char} value is a Unicode 4762 * <i>surrogate code unit</i>. 4763 * 4764 * <p>Such values do not represent characters by themselves, 4765 * but are used in the representation of 4766 * <a href="#supplementary">supplementary characters</a> 4767 * in the UTF-16 encoding. 4768 * 4769 * <p>A char value is a surrogate code unit if and only if it is either 4770 * a {@linkplain #isLowSurrogate(char) low-surrogate code unit} or 4771 * a {@linkplain #isHighSurrogate(char) high-surrogate code unit}. 4772 * 4773 * @param ch the {@code char} value to be tested. 4774 * @return {@code true} if the {@code char} value is between 4775 * {@link #MIN_SURROGATE} and 4776 * {@link #MAX_SURROGATE} inclusive; 4777 * {@code false} otherwise. 4778 * @since 1.7 4779 */ 4780 public static boolean isSurrogate(char ch) { 4781 return ch >= MIN_SURROGATE && ch < (MAX_SURROGATE + 1); 4782 } 4783 4784 /** 4785 * Determines whether the specified pair of {@code char} 4786 * values is a valid 4787 * <a href="http://www.unicode.org/glossary/#surrogate_pair"> 4788 * Unicode surrogate pair</a>. 4789 4790 * <p>This method is equivalent to the expression: 4791 * <blockquote><pre>{@code 4792 * isHighSurrogate(high) && isLowSurrogate(low) 4793 * }</pre></blockquote> 4794 * 4795 * @param high the high-surrogate code value to be tested 4796 * @param low the low-surrogate code value to be tested 4797 * @return {@code true} if the specified high and 4798 * low-surrogate code values represent a valid surrogate pair; 4799 * {@code false} otherwise. 4800 * @since 1.5 4801 */ 4802 public static boolean isSurrogatePair(char high, char low) { 4803 return isHighSurrogate(high) && isLowSurrogate(low); 4804 } 4805 4806 /** 4807 * Determines the number of {@code char} values needed to 4808 * represent the specified character (Unicode code point). If the 4809 * specified character is equal to or greater than 0x10000, then 4810 * the method returns 2. Otherwise, the method returns 1. 4811 * 4812 * <p>This method doesn't validate the specified character to be a 4813 * valid Unicode code point. The caller must validate the 4814 * character value using {@link #isValidCodePoint(int) isValidCodePoint} 4815 * if necessary. 4816 * 4817 * @param codePoint the character (Unicode code point) to be tested. 4818 * @return 2 if the character is a valid supplementary character; 1 otherwise. 4819 * @see Character#isSupplementaryCodePoint(int) 4820 * @since 1.5 4821 */ 4822 public static int charCount(int codePoint) { 4823 return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT ? 2 : 1; 4824 } 4825 4826 /** 4827 * Converts the specified surrogate pair to its supplementary code 4828 * point value. This method does not validate the specified 4829 * surrogate pair. The caller must validate it using {@link 4830 * #isSurrogatePair(char, char) isSurrogatePair} if necessary. 4831 * 4832 * @param high the high-surrogate code unit 4833 * @param low the low-surrogate code unit 4834 * @return the supplementary code point composed from the 4835 * specified surrogate pair. 4836 * @since 1.5 4837 */ 4838 public static int toCodePoint(char high, char low) { 4839 // Optimized form of: 4840 // return ((high - MIN_HIGH_SURROGATE) << 10) 4841 // + (low - MIN_LOW_SURROGATE) 4842 // + MIN_SUPPLEMENTARY_CODE_POINT; 4843 return ((high << 10) + low) + (MIN_SUPPLEMENTARY_CODE_POINT 4844 - (MIN_HIGH_SURROGATE << 10) 4845 - MIN_LOW_SURROGATE); 4846 } 4847 4848 /** 4849 * Returns the code point at the given index of the 4850 * {@code CharSequence}. If the {@code char} value at 4851 * the given index in the {@code CharSequence} is in the 4852 * high-surrogate range, the following index is less than the 4853 * length of the {@code CharSequence}, and the 4854 * {@code char} value at the following index is in the 4855 * low-surrogate range, then the supplementary code point 4856 * corresponding to this surrogate pair is returned. Otherwise, 4857 * the {@code char} value at the given index is returned. 4858 * 4859 * @param seq a sequence of {@code char} values (Unicode code 4860 * units) 4861 * @param index the index to the {@code char} values (Unicode 4862 * code units) in {@code seq} to be converted 4863 * @return the Unicode code point at the given index 4864 * @exception NullPointerException if {@code seq} is null. 4865 * @exception IndexOutOfBoundsException if the value 4866 * {@code index} is negative or not less than 4867 * {@link CharSequence#length() seq.length()}. 4868 * @since 1.5 4869 */ 4870 public static int codePointAt(CharSequence seq, int index) { 4871 char c1 = seq.charAt(index); 4872 if (isHighSurrogate(c1) && ++index < seq.length()) { 4873 char c2 = seq.charAt(index); 4874 if (isLowSurrogate(c2)) { 4875 return toCodePoint(c1, c2); 4876 } 4877 } 4878 return c1; 4879 } 4880 4881 /** 4882 * Returns the code point at the given index of the 4883 * {@code char} array. If the {@code char} value at 4884 * the given index in the {@code char} array is in the 4885 * high-surrogate range, the following index is less than the 4886 * length of the {@code char} array, and the 4887 * {@code char} value at the following index is in the 4888 * low-surrogate range, then the supplementary code point 4889 * corresponding to this surrogate pair is returned. Otherwise, 4890 * the {@code char} value at the given index is returned. 4891 * 4892 * @param a the {@code char} array 4893 * @param index the index to the {@code char} values (Unicode 4894 * code units) in the {@code char} array to be converted 4895 * @return the Unicode code point at the given index 4896 * @exception NullPointerException if {@code a} is null. 4897 * @exception IndexOutOfBoundsException if the value 4898 * {@code index} is negative or not less than 4899 * the length of the {@code char} array. 4900 * @since 1.5 4901 */ 4902 public static int codePointAt(char[] a, int index) { 4903 return codePointAtImpl(a, index, a.length); 4904 } 4905 4906 /** 4907 * Returns the code point at the given index of the 4908 * {@code char} array, where only array elements with 4909 * {@code index} less than {@code limit} can be used. If 4910 * the {@code char} value at the given index in the 4911 * {@code char} array is in the high-surrogate range, the 4912 * following index is less than the {@code limit}, and the 4913 * {@code char} value at the following index is in the 4914 * low-surrogate range, then the supplementary code point 4915 * corresponding to this surrogate pair is returned. Otherwise, 4916 * the {@code char} value at the given index is returned. 4917 * 4918 * @param a the {@code char} array 4919 * @param index the index to the {@code char} values (Unicode 4920 * code units) in the {@code char} array to be converted 4921 * @param limit the index after the last array element that 4922 * can be used in the {@code char} array 4923 * @return the Unicode code point at the given index 4924 * @exception NullPointerException if {@code a} is null. 4925 * @exception IndexOutOfBoundsException if the {@code index} 4926 * argument is negative or not less than the {@code limit} 4927 * argument, or if the {@code limit} argument is negative or 4928 * greater than the length of the {@code char} array. 4929 * @since 1.5 4930 */ 4931 public static int codePointAt(char[] a, int index, int limit) { 4932 if (index >= limit || limit < 0 || limit > a.length) { 4933 throw new IndexOutOfBoundsException(); 4934 } 4935 return codePointAtImpl(a, index, limit); 4936 } 4937 4938 // throws ArrayIndexOutOfBoundsException if index out of bounds 4939 static int codePointAtImpl(char[] a, int index, int limit) { 4940 char c1 = a[index]; 4941 if (isHighSurrogate(c1) && ++index < limit) { 4942 char c2 = a[index]; 4943 if (isLowSurrogate(c2)) { 4944 return toCodePoint(c1, c2); 4945 } 4946 } 4947 return c1; 4948 } 4949 4950 /** 4951 * Returns the code point preceding the given index of the 4952 * {@code CharSequence}. If the {@code char} value at 4953 * {@code (index - 1)} in the {@code CharSequence} is in 4954 * the low-surrogate range, {@code (index - 2)} is not 4955 * negative, and the {@code char} value at {@code (index - 2)} 4956 * in the {@code CharSequence} is in the 4957 * high-surrogate range, then the supplementary code point 4958 * corresponding to this surrogate pair is returned. Otherwise, 4959 * the {@code char} value at {@code (index - 1)} is 4960 * returned. 4961 * 4962 * @param seq the {@code CharSequence} instance 4963 * @param index the index following the code point that should be returned 4964 * @return the Unicode code point value before the given index. 4965 * @exception NullPointerException if {@code seq} is null. 4966 * @exception IndexOutOfBoundsException if the {@code index} 4967 * argument is less than 1 or greater than {@link 4968 * CharSequence#length() seq.length()}. 4969 * @since 1.5 4970 */ 4971 public static int codePointBefore(CharSequence seq, int index) { 4972 char c2 = seq.charAt(--index); 4973 if (isLowSurrogate(c2) && index > 0) { 4974 char c1 = seq.charAt(--index); 4975 if (isHighSurrogate(c1)) { 4976 return toCodePoint(c1, c2); 4977 } 4978 } 4979 return c2; 4980 } 4981 4982 /** 4983 * Returns the code point preceding the given index of the 4984 * {@code char} array. If the {@code char} value at 4985 * {@code (index - 1)} in the {@code char} array is in 4986 * the low-surrogate range, {@code (index - 2)} is not 4987 * negative, and the {@code char} value at {@code (index - 2)} 4988 * in the {@code char} array is in the 4989 * high-surrogate range, then the supplementary code point 4990 * corresponding to this surrogate pair is returned. Otherwise, 4991 * the {@code char} value at {@code (index - 1)} is 4992 * returned. 4993 * 4994 * @param a the {@code char} array 4995 * @param index the index following the code point that should be returned 4996 * @return the Unicode code point value before the given index. 4997 * @exception NullPointerException if {@code a} is null. 4998 * @exception IndexOutOfBoundsException if the {@code index} 4999 * argument is less than 1 or greater than the length of the 5000 * {@code char} array 5001 * @since 1.5 5002 */ 5003 public static int codePointBefore(char[] a, int index) { 5004 return codePointBeforeImpl(a, index, 0); 5005 } 5006 5007 /** 5008 * Returns the code point preceding the given index of the 5009 * {@code char} array, where only array elements with 5010 * {@code index} greater than or equal to {@code start} 5011 * can be used. If the {@code char} value at {@code (index - 1)} 5012 * in the {@code char} array is in the 5013 * low-surrogate range, {@code (index - 2)} is not less than 5014 * {@code start}, and the {@code char} value at 5015 * {@code (index - 2)} in the {@code char} array is in 5016 * the high-surrogate range, then the supplementary code point 5017 * corresponding to this surrogate pair is returned. Otherwise, 5018 * the {@code char} value at {@code (index - 1)} is 5019 * returned. 5020 * 5021 * @param a the {@code char} array 5022 * @param index the index following the code point that should be returned 5023 * @param start the index of the first array element in the 5024 * {@code char} array 5025 * @return the Unicode code point value before the given index. 5026 * @exception NullPointerException if {@code a} is null. 5027 * @exception IndexOutOfBoundsException if the {@code index} 5028 * argument is not greater than the {@code start} argument or 5029 * is greater than the length of the {@code char} array, or 5030 * if the {@code start} argument is negative or not less than 5031 * the length of the {@code char} array. 5032 * @since 1.5 5033 */ 5034 public static int codePointBefore(char[] a, int index, int start) { 5035 if (index <= start || start < 0 || start >= a.length) { 5036 throw new IndexOutOfBoundsException(); 5037 } 5038 return codePointBeforeImpl(a, index, start); 5039 } 5040 5041 // throws ArrayIndexOutOfBoundsException if index-1 out of bounds 5042 static int codePointBeforeImpl(char[] a, int index, int start) { 5043 char c2 = a[--index]; 5044 if (isLowSurrogate(c2) && index > start) { 5045 char c1 = a[--index]; 5046 if (isHighSurrogate(c1)) { 5047 return toCodePoint(c1, c2); 5048 } 5049 } 5050 return c2; 5051 } 5052 5053 /** 5054 * Returns the leading surrogate (a 5055 * <a href="http://www.unicode.org/glossary/#high_surrogate_code_unit"> 5056 * high surrogate code unit</a>) of the 5057 * <a href="http://www.unicode.org/glossary/#surrogate_pair"> 5058 * surrogate pair</a> 5059 * representing the specified supplementary character (Unicode 5060 * code point) in the UTF-16 encoding. If the specified character 5061 * is not a 5062 * <a href="Character.html#supplementary">supplementary character</a>, 5063 * an unspecified {@code char} is returned. 5064 * 5065 * <p>If 5066 * {@link #isSupplementaryCodePoint isSupplementaryCodePoint(x)} 5067 * is {@code true}, then 5068 * {@link #isHighSurrogate isHighSurrogate}{@code (highSurrogate(x))} and 5069 * {@link #toCodePoint toCodePoint}{@code (highSurrogate(x), }{@link #lowSurrogate lowSurrogate}{@code (x)) == x} 5070 * are also always {@code true}. 5071 * 5072 * @param codePoint a supplementary character (Unicode code point) 5073 * @return the leading surrogate code unit used to represent the 5074 * character in the UTF-16 encoding 5075 * @since 1.7 5076 */ 5077 public static char highSurrogate(int codePoint) { 5078 return (char) ((codePoint >>> 10) 5079 + (MIN_HIGH_SURROGATE - (MIN_SUPPLEMENTARY_CODE_POINT >>> 10))); 5080 } 5081 5082 /** 5083 * Returns the trailing surrogate (a 5084 * <a href="http://www.unicode.org/glossary/#low_surrogate_code_unit"> 5085 * low surrogate code unit</a>) of the 5086 * <a href="http://www.unicode.org/glossary/#surrogate_pair"> 5087 * surrogate pair</a> 5088 * representing the specified supplementary character (Unicode 5089 * code point) in the UTF-16 encoding. If the specified character 5090 * is not a 5091 * <a href="Character.html#supplementary">supplementary character</a>, 5092 * an unspecified {@code char} is returned. 5093 * 5094 * <p>If 5095 * {@link #isSupplementaryCodePoint isSupplementaryCodePoint(x)} 5096 * is {@code true}, then 5097 * {@link #isLowSurrogate isLowSurrogate}{@code (lowSurrogate(x))} and 5098 * {@link #toCodePoint toCodePoint}{@code (}{@link #highSurrogate highSurrogate}{@code (x), lowSurrogate(x)) == x} 5099 * are also always {@code true}. 5100 * 5101 * @param codePoint a supplementary character (Unicode code point) 5102 * @return the trailing surrogate code unit used to represent the 5103 * character in the UTF-16 encoding 5104 * @since 1.7 5105 */ 5106 public static char lowSurrogate(int codePoint) { 5107 return (char) ((codePoint & 0x3ff) + MIN_LOW_SURROGATE); 5108 } 5109 5110 /** 5111 * Converts the specified character (Unicode code point) to its 5112 * UTF-16 representation. If the specified code point is a BMP 5113 * (Basic Multilingual Plane or Plane 0) value, the same value is 5114 * stored in {@code dst[dstIndex]}, and 1 is returned. If the 5115 * specified code point is a supplementary character, its 5116 * surrogate values are stored in {@code dst[dstIndex]} 5117 * (high-surrogate) and {@code dst[dstIndex+1]} 5118 * (low-surrogate), and 2 is returned. 5119 * 5120 * @param codePoint the character (Unicode code point) to be converted. 5121 * @param dst an array of {@code char} in which the 5122 * {@code codePoint}'s UTF-16 value is stored. 5123 * @param dstIndex the start index into the {@code dst} 5124 * array where the converted value is stored. 5125 * @return 1 if the code point is a BMP code point, 2 if the 5126 * code point is a supplementary code point. 5127 * @exception IllegalArgumentException if the specified 5128 * {@code codePoint} is not a valid Unicode code point. 5129 * @exception NullPointerException if the specified {@code dst} is null. 5130 * @exception IndexOutOfBoundsException if {@code dstIndex} 5131 * is negative or not less than {@code dst.length}, or if 5132 * {@code dst} at {@code dstIndex} doesn't have enough 5133 * array element(s) to store the resulting {@code char} 5134 * value(s). (If {@code dstIndex} is equal to 5135 * {@code dst.length-1} and the specified 5136 * {@code codePoint} is a supplementary character, the 5137 * high-surrogate value is not stored in 5138 * {@code dst[dstIndex]}.) 5139 * @since 1.5 5140 */ 5141 public static int toChars(int codePoint, char[] dst, int dstIndex) { 5142 if (isBmpCodePoint(codePoint)) { 5143 dst[dstIndex] = (char) codePoint; 5144 return 1; 5145 } else if (isValidCodePoint(codePoint)) { 5146 toSurrogates(codePoint, dst, dstIndex); 5147 return 2; 5148 } else { 5149 throw new IllegalArgumentException(); 5150 } 5151 } 5152 5153 /** 5154 * Converts the specified character (Unicode code point) to its 5155 * UTF-16 representation stored in a {@code char} array. If 5156 * the specified code point is a BMP (Basic Multilingual Plane or 5157 * Plane 0) value, the resulting {@code char} array has 5158 * the same value as {@code codePoint}. If the specified code 5159 * point is a supplementary code point, the resulting 5160 * {@code char} array has the corresponding surrogate pair. 5161 * 5162 * @param codePoint a Unicode code point 5163 * @return a {@code char} array having 5164 * {@code codePoint}'s UTF-16 representation. 5165 * @exception IllegalArgumentException if the specified 5166 * {@code codePoint} is not a valid Unicode code point. 5167 * @since 1.5 5168 */ 5169 public static char[] toChars(int codePoint) { 5170 if (isBmpCodePoint(codePoint)) { 5171 return new char[] { (char) codePoint }; 5172 } else if (isValidCodePoint(codePoint)) { 5173 char[] result = new char[2]; 5174 toSurrogates(codePoint, result, 0); 5175 return result; 5176 } else { 5177 throw new IllegalArgumentException(); 5178 } 5179 } 5180 5181 static void toSurrogates(int codePoint, char[] dst, int index) { 5182 // We write elements "backwards" to guarantee all-or-nothing 5183 dst[index+1] = lowSurrogate(codePoint); 5184 dst[index] = highSurrogate(codePoint); 5185 } 5186 5187 /** 5188 * Returns the number of Unicode code points in the text range of 5189 * the specified char sequence. The text range begins at the 5190 * specified {@code beginIndex} and extends to the 5191 * {@code char} at index {@code endIndex - 1}. Thus the 5192 * length (in {@code char}s) of the text range is 5193 * {@code endIndex-beginIndex}. Unpaired surrogates within 5194 * the text range count as one code point each. 5195 * 5196 * @param seq the char sequence 5197 * @param beginIndex the index to the first {@code char} of 5198 * the text range. 5199 * @param endIndex the index after the last {@code char} of 5200 * the text range. 5201 * @return the number of Unicode code points in the specified text 5202 * range 5203 * @exception NullPointerException if {@code seq} is null. 5204 * @exception IndexOutOfBoundsException if the 5205 * {@code beginIndex} is negative, or {@code endIndex} 5206 * is larger than the length of the given sequence, or 5207 * {@code beginIndex} is larger than {@code endIndex}. 5208 * @since 1.5 5209 */ 5210 public static int codePointCount(CharSequence seq, int beginIndex, int endIndex) { 5211 int length = seq.length(); 5212 if (beginIndex < 0 || endIndex > length || beginIndex > endIndex) { 5213 throw new IndexOutOfBoundsException(); 5214 } 5215 int n = endIndex - beginIndex; 5216 for (int i = beginIndex; i < endIndex; ) { 5217 if (isHighSurrogate(seq.charAt(i++)) && i < endIndex && 5218 isLowSurrogate(seq.charAt(i))) { 5219 n--; 5220 i++; 5221 } 5222 } 5223 return n; 5224 } 5225 5226 /** 5227 * Returns the number of Unicode code points in a subarray of the 5228 * {@code char} array argument. The {@code offset} 5229 * argument is the index of the first {@code char} of the 5230 * subarray and the {@code count} argument specifies the 5231 * length of the subarray in {@code char}s. Unpaired 5232 * surrogates within the subarray count as one code point each. 5233 * 5234 * @param a the {@code char} array 5235 * @param offset the index of the first {@code char} in the 5236 * given {@code char} array 5237 * @param count the length of the subarray in {@code char}s 5238 * @return the number of Unicode code points in the specified subarray 5239 * @exception NullPointerException if {@code a} is null. 5240 * @exception IndexOutOfBoundsException if {@code offset} or 5241 * {@code count} is negative, or if {@code offset + 5242 * count} is larger than the length of the given array. 5243 * @since 1.5 5244 */ 5245 public static int codePointCount(char[] a, int offset, int count) { 5246 if (count > a.length - offset || offset < 0 || count < 0) { 5247 throw new IndexOutOfBoundsException(); 5248 } 5249 return codePointCountImpl(a, offset, count); 5250 } 5251 5252 static int codePointCountImpl(char[] a, int offset, int count) { 5253 int endIndex = offset + count; 5254 int n = count; 5255 for (int i = offset; i < endIndex; ) { 5256 if (isHighSurrogate(a[i++]) && i < endIndex && 5257 isLowSurrogate(a[i])) { 5258 n--; 5259 i++; 5260 } 5261 } 5262 return n; 5263 } 5264 5265 /** 5266 * Returns the index within the given char sequence that is offset 5267 * from the given {@code index} by {@code codePointOffset} 5268 * code points. Unpaired surrogates within the text range given by 5269 * {@code index} and {@code codePointOffset} count as 5270 * one code point each. 5271 * 5272 * @param seq the char sequence 5273 * @param index the index to be offset 5274 * @param codePointOffset the offset in code points 5275 * @return the index within the char sequence 5276 * @exception NullPointerException if {@code seq} is null. 5277 * @exception IndexOutOfBoundsException if {@code index} 5278 * is negative or larger then the length of the char sequence, 5279 * or if {@code codePointOffset} is positive and the 5280 * subsequence starting with {@code index} has fewer than 5281 * {@code codePointOffset} code points, or if 5282 * {@code codePointOffset} is negative and the subsequence 5283 * before {@code index} has fewer than the absolute value 5284 * of {@code codePointOffset} code points. 5285 * @since 1.5 5286 */ 5287 public static int offsetByCodePoints(CharSequence seq, int index, 5288 int codePointOffset) { 5289 int length = seq.length(); 5290 if (index < 0 || index > length) { 5291 throw new IndexOutOfBoundsException(); 5292 } 5293 5294 int x = index; 5295 if (codePointOffset >= 0) { 5296 int i; 5297 for (i = 0; x < length && i < codePointOffset; i++) { 5298 if (isHighSurrogate(seq.charAt(x++)) && x < length && 5299 isLowSurrogate(seq.charAt(x))) { 5300 x++; 5301 } 5302 } 5303 if (i < codePointOffset) { 5304 throw new IndexOutOfBoundsException(); 5305 } 5306 } else { 5307 int i; 5308 for (i = codePointOffset; x > 0 && i < 0; i++) { 5309 if (isLowSurrogate(seq.charAt(--x)) && x > 0 && 5310 isHighSurrogate(seq.charAt(x-1))) { 5311 x--; 5312 } 5313 } 5314 if (i < 0) { 5315 throw new IndexOutOfBoundsException(); 5316 } 5317 } 5318 return x; 5319 } 5320 5321 /** 5322 * Returns the index within the given {@code char} subarray 5323 * that is offset from the given {@code index} by 5324 * {@code codePointOffset} code points. The 5325 * {@code start} and {@code count} arguments specify a 5326 * subarray of the {@code char} array. Unpaired surrogates 5327 * within the text range given by {@code index} and 5328 * {@code codePointOffset} count as one code point each. 5329 * 5330 * @param a the {@code char} array 5331 * @param start the index of the first {@code char} of the 5332 * subarray 5333 * @param count the length of the subarray in {@code char}s 5334 * @param index the index to be offset 5335 * @param codePointOffset the offset in code points 5336 * @return the index within the subarray 5337 * @exception NullPointerException if {@code a} is null. 5338 * @exception IndexOutOfBoundsException 5339 * if {@code start} or {@code count} is negative, 5340 * or if {@code start + count} is larger than the length of 5341 * the given array, 5342 * or if {@code index} is less than {@code start} or 5343 * larger then {@code start + count}, 5344 * or if {@code codePointOffset} is positive and the text range 5345 * starting with {@code index} and ending with {@code start + count - 1} 5346 * has fewer than {@code codePointOffset} code 5347 * points, 5348 * or if {@code codePointOffset} is negative and the text range 5349 * starting with {@code start} and ending with {@code index - 1} 5350 * has fewer than the absolute value of 5351 * {@code codePointOffset} code points. 5352 * @since 1.5 5353 */ 5354 public static int offsetByCodePoints(char[] a, int start, int count, 5355 int index, int codePointOffset) { 5356 if (count > a.length-start || start < 0 || count < 0 5357 || index < start || index > start+count) { 5358 throw new IndexOutOfBoundsException(); 5359 } 5360 return offsetByCodePointsImpl(a, start, count, index, codePointOffset); 5361 } 5362 5363 static int offsetByCodePointsImpl(char[]a, int start, int count, 5364 int index, int codePointOffset) { 5365 int x = index; 5366 if (codePointOffset >= 0) { 5367 int limit = start + count; 5368 int i; 5369 for (i = 0; x < limit && i < codePointOffset; i++) { 5370 if (isHighSurrogate(a[x++]) && x < limit && 5371 isLowSurrogate(a[x])) { 5372 x++; 5373 } 5374 } 5375 if (i < codePointOffset) { 5376 throw new IndexOutOfBoundsException(); 5377 } 5378 } else { 5379 int i; 5380 for (i = codePointOffset; x > start && i < 0; i++) { 5381 if (isLowSurrogate(a[--x]) && x > start && 5382 isHighSurrogate(a[x-1])) { 5383 x--; 5384 } 5385 } 5386 if (i < 0) { 5387 throw new IndexOutOfBoundsException(); 5388 } 5389 } 5390 return x; 5391 } 5392 5393 /** 5394 * Determines if the specified character is a lowercase character. 5395 * <p> 5396 * A character is lowercase if its general category type, provided 5397 * by {@code Character.getType(ch)}, is 5398 * {@code LOWERCASE_LETTER}, or it has contributory property 5399 * Other_Lowercase as defined by the Unicode Standard. 5400 * <p> 5401 * The following are examples of lowercase characters: 5402 * <blockquote><pre> 5403 * 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 5404 * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6' 5405 * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE' 5406 * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6' 5407 * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF' 5408 * </pre></blockquote> 5409 * <p> Many other Unicode characters are lowercase too. 5410 * 5411 * <p><b>Note:</b> This method cannot handle <a 5412 * href="#supplementary"> supplementary characters</a>. To support 5413 * all Unicode characters, including supplementary characters, use 5414 * the {@link #isLowerCase(int)} method. 5415 * 5416 * @param ch the character to be tested. 5417 * @return {@code true} if the character is lowercase; 5418 * {@code false} otherwise. 5419 * @see Character#isLowerCase(char) 5420 * @see Character#isTitleCase(char) 5421 * @see Character#toLowerCase(char) 5422 * @see Character#getType(char) 5423 */ 5424 public static boolean isLowerCase(char ch) { 5425 return isLowerCase((int)ch); 5426 } 5427 5428 /** 5429 * Determines if the specified character (Unicode code point) is a 5430 * lowercase character. 5431 * <p> 5432 * A character is lowercase if its general category type, provided 5433 * by {@link Character#getType getType(codePoint)}, is 5434 * {@code LOWERCASE_LETTER}, or it has contributory property 5435 * Other_Lowercase as defined by the Unicode Standard. 5436 * <p> 5437 * The following are examples of lowercase characters: 5438 * <blockquote><pre> 5439 * 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 5440 * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6' 5441 * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE' 5442 * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6' 5443 * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF' 5444 * </pre></blockquote> 5445 * <p> Many other Unicode characters are lowercase too. 5446 * 5447 * @param codePoint the character (Unicode code point) to be tested. 5448 * @return {@code true} if the character is lowercase; 5449 * {@code false} otherwise. 5450 * @see Character#isLowerCase(int) 5451 * @see Character#isTitleCase(int) 5452 * @see Character#toLowerCase(int) 5453 * @see Character#getType(int) 5454 * @since 1.5 5455 */ 5456 public static boolean isLowerCase(int codePoint) { 5457 return getType(codePoint) == Character.LOWERCASE_LETTER || 5458 CharacterData.of(codePoint).isOtherLowercase(codePoint); 5459 } 5460 5461 /** 5462 * Determines if the specified character is an uppercase character. 5463 * <p> 5464 * A character is uppercase if its general category type, provided by 5465 * {@code Character.getType(ch)}, is {@code UPPERCASE_LETTER}. 5466 * or it has contributory property Other_Uppercase as defined by the Unicode Standard. 5467 * <p> 5468 * The following are examples of uppercase characters: 5469 * <blockquote><pre> 5470 * 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 5471 * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7' 5472 * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF' 5473 * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8' 5474 * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE' 5475 * </pre></blockquote> 5476 * <p> Many other Unicode characters are uppercase too. 5477 * 5478 * <p><b>Note:</b> This method cannot handle <a 5479 * href="#supplementary"> supplementary characters</a>. To support 5480 * all Unicode characters, including supplementary characters, use 5481 * the {@link #isUpperCase(int)} method. 5482 * 5483 * @param ch the character to be tested. 5484 * @return {@code true} if the character is uppercase; 5485 * {@code false} otherwise. 5486 * @see Character#isLowerCase(char) 5487 * @see Character#isTitleCase(char) 5488 * @see Character#toUpperCase(char) 5489 * @see Character#getType(char) 5490 * @since 1.0 5491 */ 5492 public static boolean isUpperCase(char ch) { 5493 return isUpperCase((int)ch); 5494 } 5495 5496 /** 5497 * Determines if the specified character (Unicode code point) is an uppercase character. 5498 * <p> 5499 * A character is uppercase if its general category type, provided by 5500 * {@link Character#getType(int) getType(codePoint)}, is {@code UPPERCASE_LETTER}, 5501 * or it has contributory property Other_Uppercase as defined by the Unicode Standard. 5502 * <p> 5503 * The following are examples of uppercase characters: 5504 * <blockquote><pre> 5505 * 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 5506 * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7' 5507 * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF' 5508 * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8' 5509 * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE' 5510 * </pre></blockquote> 5511 * <p> Many other Unicode characters are uppercase too. 5512 * 5513 * @param codePoint the character (Unicode code point) to be tested. 5514 * @return {@code true} if the character is uppercase; 5515 * {@code false} otherwise. 5516 * @see Character#isLowerCase(int) 5517 * @see Character#isTitleCase(int) 5518 * @see Character#toUpperCase(int) 5519 * @see Character#getType(int) 5520 * @since 1.5 5521 */ 5522 public static boolean isUpperCase(int codePoint) { 5523 return getType(codePoint) == Character.UPPERCASE_LETTER || 5524 CharacterData.of(codePoint).isOtherUppercase(codePoint); 5525 } 5526 5527 /** 5528 * Determines if the specified character is a titlecase character. 5529 * <p> 5530 * A character is a titlecase character if its general 5531 * category type, provided by {@code Character.getType(ch)}, 5532 * is {@code TITLECASE_LETTER}. 5533 * <p> 5534 * Some characters look like pairs of Latin letters. For example, there 5535 * is an uppercase letter that looks like "LJ" and has a corresponding 5536 * lowercase letter that looks like "lj". A third form, which looks like "Lj", 5537 * is the appropriate form to use when rendering a word in lowercase 5538 * with initial capitals, as for a book title. 5539 * <p> 5540 * These are some of the Unicode characters for which this method returns 5541 * {@code true}: 5542 * <ul> 5543 * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON} 5544 * <li>{@code LATIN CAPITAL LETTER L WITH SMALL LETTER J} 5545 * <li>{@code LATIN CAPITAL LETTER N WITH SMALL LETTER J} 5546 * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z} 5547 * </ul> 5548 * <p> Many other Unicode characters are titlecase too. 5549 * 5550 * <p><b>Note:</b> This method cannot handle <a 5551 * href="#supplementary"> supplementary characters</a>. To support 5552 * all Unicode characters, including supplementary characters, use 5553 * the {@link #isTitleCase(int)} method. 5554 * 5555 * @param ch the character to be tested. 5556 * @return {@code true} if the character is titlecase; 5557 * {@code false} otherwise. 5558 * @see Character#isLowerCase(char) 5559 * @see Character#isUpperCase(char) 5560 * @see Character#toTitleCase(char) 5561 * @see Character#getType(char) 5562 * @since 1.0.2 5563 */ 5564 public static boolean isTitleCase(char ch) { 5565 return isTitleCase((int)ch); 5566 } 5567 5568 /** 5569 * Determines if the specified character (Unicode code point) is a titlecase character. 5570 * <p> 5571 * A character is a titlecase character if its general 5572 * category type, provided by {@link Character#getType(int) getType(codePoint)}, 5573 * is {@code TITLECASE_LETTER}. 5574 * <p> 5575 * Some characters look like pairs of Latin letters. For example, there 5576 * is an uppercase letter that looks like "LJ" and has a corresponding 5577 * lowercase letter that looks like "lj". A third form, which looks like "Lj", 5578 * is the appropriate form to use when rendering a word in lowercase 5579 * with initial capitals, as for a book title. 5580 * <p> 5581 * These are some of the Unicode characters for which this method returns 5582 * {@code true}: 5583 * <ul> 5584 * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON} 5585 * <li>{@code LATIN CAPITAL LETTER L WITH SMALL LETTER J} 5586 * <li>{@code LATIN CAPITAL LETTER N WITH SMALL LETTER J} 5587 * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z} 5588 * </ul> 5589 * <p> Many other Unicode characters are titlecase too. 5590 * 5591 * @param codePoint the character (Unicode code point) to be tested. 5592 * @return {@code true} if the character is titlecase; 5593 * {@code false} otherwise. 5594 * @see Character#isLowerCase(int) 5595 * @see Character#isUpperCase(int) 5596 * @see Character#toTitleCase(int) 5597 * @see Character#getType(int) 5598 * @since 1.5 5599 */ 5600 public static boolean isTitleCase(int codePoint) { 5601 return getType(codePoint) == Character.TITLECASE_LETTER; 5602 } 5603 5604 /** 5605 * Determines if the specified character is a digit. 5606 * <p> 5607 * A character is a digit if its general category type, provided 5608 * by {@code Character.getType(ch)}, is 5609 * {@code DECIMAL_DIGIT_NUMBER}. 5610 * <p> 5611 * Some Unicode character ranges that contain digits: 5612 * <ul> 5613 * <li>{@code '\u005Cu0030'} through {@code '\u005Cu0039'}, 5614 * ISO-LATIN-1 digits ({@code '0'} through {@code '9'}) 5615 * <li>{@code '\u005Cu0660'} through {@code '\u005Cu0669'}, 5616 * Arabic-Indic digits 5617 * <li>{@code '\u005Cu06F0'} through {@code '\u005Cu06F9'}, 5618 * Extended Arabic-Indic digits 5619 * <li>{@code '\u005Cu0966'} through {@code '\u005Cu096F'}, 5620 * Devanagari digits 5621 * <li>{@code '\u005CuFF10'} through {@code '\u005CuFF19'}, 5622 * Fullwidth digits 5623 * </ul> 5624 * 5625 * Many other character ranges contain digits as well. 5626 * 5627 * <p><b>Note:</b> This method cannot handle <a 5628 * href="#supplementary"> supplementary characters</a>. To support 5629 * all Unicode characters, including supplementary characters, use 5630 * the {@link #isDigit(int)} method. 5631 * 5632 * @param ch the character to be tested. 5633 * @return {@code true} if the character is a digit; 5634 * {@code false} otherwise. 5635 * @see Character#digit(char, int) 5636 * @see Character#forDigit(int, int) 5637 * @see Character#getType(char) 5638 */ 5639 public static boolean isDigit(char ch) { 5640 return isDigit((int)ch); 5641 } 5642 5643 /** 5644 * Determines if the specified character (Unicode code point) is a digit. 5645 * <p> 5646 * A character is a digit if its general category type, provided 5647 * by {@link Character#getType(int) getType(codePoint)}, is 5648 * {@code DECIMAL_DIGIT_NUMBER}. 5649 * <p> 5650 * Some Unicode character ranges that contain digits: 5651 * <ul> 5652 * <li>{@code '\u005Cu0030'} through {@code '\u005Cu0039'}, 5653 * ISO-LATIN-1 digits ({@code '0'} through {@code '9'}) 5654 * <li>{@code '\u005Cu0660'} through {@code '\u005Cu0669'}, 5655 * Arabic-Indic digits 5656 * <li>{@code '\u005Cu06F0'} through {@code '\u005Cu06F9'}, 5657 * Extended Arabic-Indic digits 5658 * <li>{@code '\u005Cu0966'} through {@code '\u005Cu096F'}, 5659 * Devanagari digits 5660 * <li>{@code '\u005CuFF10'} through {@code '\u005CuFF19'}, 5661 * Fullwidth digits 5662 * </ul> 5663 * 5664 * Many other character ranges contain digits as well. 5665 * 5666 * @param codePoint the character (Unicode code point) to be tested. 5667 * @return {@code true} if the character is a digit; 5668 * {@code false} otherwise. 5669 * @see Character#forDigit(int, int) 5670 * @see Character#getType(int) 5671 * @since 1.5 5672 */ 5673 public static boolean isDigit(int codePoint) { 5674 return getType(codePoint) == Character.DECIMAL_DIGIT_NUMBER; 5675 } 5676 5677 /** 5678 * Determines if a character is defined in Unicode. 5679 * <p> 5680 * A character is defined if at least one of the following is true: 5681 * <ul> 5682 * <li>It has an entry in the UnicodeData file. 5683 * <li>It has a value in a range defined by the UnicodeData file. 5684 * </ul> 5685 * 5686 * <p><b>Note:</b> This method cannot handle <a 5687 * href="#supplementary"> supplementary characters</a>. To support 5688 * all Unicode characters, including supplementary characters, use 5689 * the {@link #isDefined(int)} method. 5690 * 5691 * @param ch the character to be tested 5692 * @return {@code true} if the character has a defined meaning 5693 * in Unicode; {@code false} otherwise. 5694 * @see Character#isDigit(char) 5695 * @see Character#isLetter(char) 5696 * @see Character#isLetterOrDigit(char) 5697 * @see Character#isLowerCase(char) 5698 * @see Character#isTitleCase(char) 5699 * @see Character#isUpperCase(char) 5700 * @since 1.0.2 5701 */ 5702 public static boolean isDefined(char ch) { 5703 return isDefined((int)ch); 5704 } 5705 5706 /** 5707 * Determines if a character (Unicode code point) is defined in Unicode. 5708 * <p> 5709 * A character is defined if at least one of the following is true: 5710 * <ul> 5711 * <li>It has an entry in the UnicodeData file. 5712 * <li>It has a value in a range defined by the UnicodeData file. 5713 * </ul> 5714 * 5715 * @param codePoint the character (Unicode code point) to be tested. 5716 * @return {@code true} if the character has a defined meaning 5717 * in Unicode; {@code false} otherwise. 5718 * @see Character#isDigit(int) 5719 * @see Character#isLetter(int) 5720 * @see Character#isLetterOrDigit(int) 5721 * @see Character#isLowerCase(int) 5722 * @see Character#isTitleCase(int) 5723 * @see Character#isUpperCase(int) 5724 * @since 1.5 5725 */ 5726 public static boolean isDefined(int codePoint) { 5727 return getType(codePoint) != Character.UNASSIGNED; 5728 } 5729 5730 /** 5731 * Determines if the specified character is a letter. 5732 * <p> 5733 * A character is considered to be a letter if its general 5734 * category type, provided by {@code Character.getType(ch)}, 5735 * is any of the following: 5736 * <ul> 5737 * <li> {@code UPPERCASE_LETTER} 5738 * <li> {@code LOWERCASE_LETTER} 5739 * <li> {@code TITLECASE_LETTER} 5740 * <li> {@code MODIFIER_LETTER} 5741 * <li> {@code OTHER_LETTER} 5742 * </ul> 5743 * 5744 * Not all letters have case. Many characters are 5745 * letters but are neither uppercase nor lowercase nor titlecase. 5746 * 5747 * <p><b>Note:</b> This method cannot handle <a 5748 * href="#supplementary"> supplementary characters</a>. To support 5749 * all Unicode characters, including supplementary characters, use 5750 * the {@link #isLetter(int)} method. 5751 * 5752 * @param ch the character to be tested. 5753 * @return {@code true} if the character is a letter; 5754 * {@code false} otherwise. 5755 * @see Character#isDigit(char) 5756 * @see Character#isJavaIdentifierStart(char) 5757 * @see Character#isJavaLetter(char) 5758 * @see Character#isJavaLetterOrDigit(char) 5759 * @see Character#isLetterOrDigit(char) 5760 * @see Character#isLowerCase(char) 5761 * @see Character#isTitleCase(char) 5762 * @see Character#isUnicodeIdentifierStart(char) 5763 * @see Character#isUpperCase(char) 5764 */ 5765 public static boolean isLetter(char ch) { 5766 return isLetter((int)ch); 5767 } 5768 5769 /** 5770 * Determines if the specified character (Unicode code point) is a letter. 5771 * <p> 5772 * A character is considered to be a letter if its general 5773 * category type, provided by {@link Character#getType(int) getType(codePoint)}, 5774 * is any of the following: 5775 * <ul> 5776 * <li> {@code UPPERCASE_LETTER} 5777 * <li> {@code LOWERCASE_LETTER} 5778 * <li> {@code TITLECASE_LETTER} 5779 * <li> {@code MODIFIER_LETTER} 5780 * <li> {@code OTHER_LETTER} 5781 * </ul> 5782 * 5783 * Not all letters have case. Many characters are 5784 * letters but are neither uppercase nor lowercase nor titlecase. 5785 * 5786 * @param codePoint the character (Unicode code point) to be tested. 5787 * @return {@code true} if the character is a letter; 5788 * {@code false} otherwise. 5789 * @see Character#isDigit(int) 5790 * @see Character#isJavaIdentifierStart(int) 5791 * @see Character#isLetterOrDigit(int) 5792 * @see Character#isLowerCase(int) 5793 * @see Character#isTitleCase(int) 5794 * @see Character#isUnicodeIdentifierStart(int) 5795 * @see Character#isUpperCase(int) 5796 * @since 1.5 5797 */ 5798 public static boolean isLetter(int codePoint) { 5799 return ((((1 << Character.UPPERCASE_LETTER) | 5800 (1 << Character.LOWERCASE_LETTER) | 5801 (1 << Character.TITLECASE_LETTER) | 5802 (1 << Character.MODIFIER_LETTER) | 5803 (1 << Character.OTHER_LETTER)) >> getType(codePoint)) & 1) 5804 != 0; 5805 } 5806 5807 /** 5808 * Determines if the specified character is a letter or digit. 5809 * <p> 5810 * A character is considered to be a letter or digit if either 5811 * {@code Character.isLetter(char ch)} or 5812 * {@code Character.isDigit(char ch)} returns 5813 * {@code true} for the character. 5814 * 5815 * <p><b>Note:</b> This method cannot handle <a 5816 * href="#supplementary"> supplementary characters</a>. To support 5817 * all Unicode characters, including supplementary characters, use 5818 * the {@link #isLetterOrDigit(int)} method. 5819 * 5820 * @param ch the character to be tested. 5821 * @return {@code true} if the character is a letter or digit; 5822 * {@code false} otherwise. 5823 * @see Character#isDigit(char) 5824 * @see Character#isJavaIdentifierPart(char) 5825 * @see Character#isJavaLetter(char) 5826 * @see Character#isJavaLetterOrDigit(char) 5827 * @see Character#isLetter(char) 5828 * @see Character#isUnicodeIdentifierPart(char) 5829 * @since 1.0.2 5830 */ 5831 public static boolean isLetterOrDigit(char ch) { 5832 return isLetterOrDigit((int)ch); 5833 } 5834 5835 /** 5836 * Determines if the specified character (Unicode code point) is a letter or digit. 5837 * <p> 5838 * A character is considered to be a letter or digit if either 5839 * {@link #isLetter(int) isLetter(codePoint)} or 5840 * {@link #isDigit(int) isDigit(codePoint)} returns 5841 * {@code true} for the character. 5842 * 5843 * @param codePoint the character (Unicode code point) to be tested. 5844 * @return {@code true} if the character is a letter or digit; 5845 * {@code false} otherwise. 5846 * @see Character#isDigit(int) 5847 * @see Character#isJavaIdentifierPart(int) 5848 * @see Character#isLetter(int) 5849 * @see Character#isUnicodeIdentifierPart(int) 5850 * @since 1.5 5851 */ 5852 public static boolean isLetterOrDigit(int codePoint) { 5853 return ((((1 << Character.UPPERCASE_LETTER) | 5854 (1 << Character.LOWERCASE_LETTER) | 5855 (1 << Character.TITLECASE_LETTER) | 5856 (1 << Character.MODIFIER_LETTER) | 5857 (1 << Character.OTHER_LETTER) | 5858 (1 << Character.DECIMAL_DIGIT_NUMBER)) >> getType(codePoint)) & 1) 5859 != 0; 5860 } 5861 5862 /** 5863 * Determines if the specified character is permissible as the first 5864 * character in a Java identifier. 5865 * <p> 5866 * A character may start a Java identifier if and only if 5867 * one of the following is true: 5868 * <ul> 5869 * <li> {@link #isLetter(char) isLetter(ch)} returns {@code true} 5870 * <li> {@link #getType(char) getType(ch)} returns {@code LETTER_NUMBER} 5871 * <li> {@code ch} is a currency symbol (such as {@code '$'}) 5872 * <li> {@code ch} is a connecting punctuation character (such as {@code '_'}). 5873 * </ul> 5874 * 5875 * @param ch the character to be tested. 5876 * @return {@code true} if the character may start a Java 5877 * identifier; {@code false} otherwise. 5878 * @see Character#isJavaLetterOrDigit(char) 5879 * @see Character#isJavaIdentifierStart(char) 5880 * @see Character#isJavaIdentifierPart(char) 5881 * @see Character#isLetter(char) 5882 * @see Character#isLetterOrDigit(char) 5883 * @see Character#isUnicodeIdentifierStart(char) 5884 * @since 1.0.2 5885 * @deprecated Replaced by isJavaIdentifierStart(char). 5886 */ 5887 @Deprecated 5888 public static boolean isJavaLetter(char ch) { 5889 return isJavaIdentifierStart(ch); 5890 } 5891 5892 /** 5893 * Determines if the specified character may be part of a Java 5894 * identifier as other than the first character. 5895 * <p> 5896 * A character may be part of a Java identifier if and only if any 5897 * of the following are true: 5898 * <ul> 5899 * <li> it is a letter 5900 * <li> it is a currency symbol (such as {@code '$'}) 5901 * <li> it is a connecting punctuation character (such as {@code '_'}) 5902 * <li> it is a digit 5903 * <li> it is a numeric letter (such as a Roman numeral character) 5904 * <li> it is a combining mark 5905 * <li> it is a non-spacing mark 5906 * <li> {@code isIdentifierIgnorable} returns 5907 * {@code true} for the character. 5908 * </ul> 5909 * 5910 * @param ch the character to be tested. 5911 * @return {@code true} if the character may be part of a 5912 * Java identifier; {@code false} otherwise. 5913 * @see Character#isJavaLetter(char) 5914 * @see Character#isJavaIdentifierStart(char) 5915 * @see Character#isJavaIdentifierPart(char) 5916 * @see Character#isLetter(char) 5917 * @see Character#isLetterOrDigit(char) 5918 * @see Character#isUnicodeIdentifierPart(char) 5919 * @see Character#isIdentifierIgnorable(char) 5920 * @since 1.0.2 5921 * @deprecated Replaced by isJavaIdentifierPart(char). 5922 */ 5923 @Deprecated 5924 public static boolean isJavaLetterOrDigit(char ch) { 5925 return isJavaIdentifierPart(ch); 5926 } 5927 5928 /** 5929 * Determines if the specified character (Unicode code point) is an alphabet. 5930 * <p> 5931 * A character is considered to be alphabetic if its general category type, 5932 * provided by {@link Character#getType(int) getType(codePoint)}, is any of 5933 * the following: 5934 * <ul> 5935 * <li> <code>UPPERCASE_LETTER</code> 5936 * <li> <code>LOWERCASE_LETTER</code> 5937 * <li> <code>TITLECASE_LETTER</code> 5938 * <li> <code>MODIFIER_LETTER</code> 5939 * <li> <code>OTHER_LETTER</code> 5940 * <li> <code>LETTER_NUMBER</code> 5941 * </ul> 5942 * or it has contributory property Other_Alphabetic as defined by the 5943 * Unicode Standard. 5944 * 5945 * @param codePoint the character (Unicode code point) to be tested. 5946 * @return <code>true</code> if the character is a Unicode alphabet 5947 * character, <code>false</code> otherwise. 5948 * @since 1.7 5949 */ 5950 public static boolean isAlphabetic(int codePoint) { 5951 return (((((1 << Character.UPPERCASE_LETTER) | 5952 (1 << Character.LOWERCASE_LETTER) | 5953 (1 << Character.TITLECASE_LETTER) | 5954 (1 << Character.MODIFIER_LETTER) | 5955 (1 << Character.OTHER_LETTER) | 5956 (1 << Character.LETTER_NUMBER)) >> getType(codePoint)) & 1) != 0) || 5957 CharacterData.of(codePoint).isOtherAlphabetic(codePoint); 5958 } 5959 5960 /** 5961 * Determines if the specified character (Unicode code point) is a CJKV 5962 * (Chinese, Japanese, Korean and Vietnamese) ideograph, as defined by 5963 * the Unicode Standard. 5964 * 5965 * @param codePoint the character (Unicode code point) to be tested. 5966 * @return <code>true</code> if the character is a Unicode ideograph 5967 * character, <code>false</code> otherwise. 5968 * @since 1.7 5969 */ 5970 public static boolean isIdeographic(int codePoint) { 5971 return CharacterData.of(codePoint).isIdeographic(codePoint); 5972 } 5973 5974 /** 5975 * Determines if the specified character is 5976 * permissible as the first character in a Java identifier. 5977 * <p> 5978 * A character may start a Java identifier if and only if 5979 * one of the following conditions is true: 5980 * <ul> 5981 * <li> {@link #isLetter(char) isLetter(ch)} returns {@code true} 5982 * <li> {@link #getType(char) getType(ch)} returns {@code LETTER_NUMBER} 5983 * <li> {@code ch} is a currency symbol (such as {@code '$'}) 5984 * <li> {@code ch} is a connecting punctuation character (such as {@code '_'}). 5985 * </ul> 5986 * 5987 * <p><b>Note:</b> This method cannot handle <a 5988 * href="#supplementary"> supplementary characters</a>. To support 5989 * all Unicode characters, including supplementary characters, use 5990 * the {@link #isJavaIdentifierStart(int)} method. 5991 * 5992 * @param ch the character to be tested. 5993 * @return {@code true} if the character may start a Java identifier; 5994 * {@code false} otherwise. 5995 * @see Character#isJavaIdentifierPart(char) 5996 * @see Character#isLetter(char) 5997 * @see Character#isUnicodeIdentifierStart(char) 5998 * @see javax.lang.model.SourceVersion#isIdentifier(CharSequence) 5999 * @since 1.1 6000 */ 6001 public static boolean isJavaIdentifierStart(char ch) { 6002 return isJavaIdentifierStart((int)ch); 6003 } 6004 6005 /** 6006 * Determines if the character (Unicode code point) is 6007 * permissible as the first character in a Java identifier. 6008 * <p> 6009 * A character may start a Java identifier if and only if 6010 * one of the following conditions is true: 6011 * <ul> 6012 * <li> {@link #isLetter(int) isLetter(codePoint)} 6013 * returns {@code true} 6014 * <li> {@link #getType(int) getType(codePoint)} 6015 * returns {@code LETTER_NUMBER} 6016 * <li> the referenced character is a currency symbol (such as {@code '$'}) 6017 * <li> the referenced character is a connecting punctuation character 6018 * (such as {@code '_'}). 6019 * </ul> 6020 * 6021 * @param codePoint the character (Unicode code point) to be tested. 6022 * @return {@code true} if the character may start a Java identifier; 6023 * {@code false} otherwise. 6024 * @see Character#isJavaIdentifierPart(int) 6025 * @see Character#isLetter(int) 6026 * @see Character#isUnicodeIdentifierStart(int) 6027 * @see javax.lang.model.SourceVersion#isIdentifier(CharSequence) 6028 * @since 1.5 6029 */ 6030 public static boolean isJavaIdentifierStart(int codePoint) { 6031 return CharacterData.of(codePoint).isJavaIdentifierStart(codePoint); 6032 } 6033 6034 /** 6035 * Determines if the specified character may be part of a Java 6036 * identifier as other than the first character. 6037 * <p> 6038 * A character may be part of a Java identifier if any of the following 6039 * are true: 6040 * <ul> 6041 * <li> it is a letter 6042 * <li> it is a currency symbol (such as {@code '$'}) 6043 * <li> it is a connecting punctuation character (such as {@code '_'}) 6044 * <li> it is a digit 6045 * <li> it is a numeric letter (such as a Roman numeral character) 6046 * <li> it is a combining mark 6047 * <li> it is a non-spacing mark 6048 * <li> {@code isIdentifierIgnorable} returns 6049 * {@code true} for the character 6050 * </ul> 6051 * 6052 * <p><b>Note:</b> This method cannot handle <a 6053 * href="#supplementary"> supplementary characters</a>. To support 6054 * all Unicode characters, including supplementary characters, use 6055 * the {@link #isJavaIdentifierPart(int)} method. 6056 * 6057 * @param ch the character to be tested. 6058 * @return {@code true} if the character may be part of a 6059 * Java identifier; {@code false} otherwise. 6060 * @see Character#isIdentifierIgnorable(char) 6061 * @see Character#isJavaIdentifierStart(char) 6062 * @see Character#isLetterOrDigit(char) 6063 * @see Character#isUnicodeIdentifierPart(char) 6064 * @see javax.lang.model.SourceVersion#isIdentifier(CharSequence) 6065 * @since 1.1 6066 */ 6067 public static boolean isJavaIdentifierPart(char ch) { 6068 return isJavaIdentifierPart((int)ch); 6069 } 6070 6071 /** 6072 * Determines if the character (Unicode code point) may be part of a Java 6073 * identifier as other than the first character. 6074 * <p> 6075 * A character may be part of a Java identifier if any of the following 6076 * are true: 6077 * <ul> 6078 * <li> it is a letter 6079 * <li> it is a currency symbol (such as {@code '$'}) 6080 * <li> it is a connecting punctuation character (such as {@code '_'}) 6081 * <li> it is a digit 6082 * <li> it is a numeric letter (such as a Roman numeral character) 6083 * <li> it is a combining mark 6084 * <li> it is a non-spacing mark 6085 * <li> {@link #isIdentifierIgnorable(int) 6086 * isIdentifierIgnorable(codePoint)} returns {@code true} for 6087 * the character 6088 * </ul> 6089 * 6090 * @param codePoint the character (Unicode code point) to be tested. 6091 * @return {@code true} if the character may be part of a 6092 * Java identifier; {@code false} otherwise. 6093 * @see Character#isIdentifierIgnorable(int) 6094 * @see Character#isJavaIdentifierStart(int) 6095 * @see Character#isLetterOrDigit(int) 6096 * @see Character#isUnicodeIdentifierPart(int) 6097 * @see javax.lang.model.SourceVersion#isIdentifier(CharSequence) 6098 * @since 1.5 6099 */ 6100 public static boolean isJavaIdentifierPart(int codePoint) { 6101 return CharacterData.of(codePoint).isJavaIdentifierPart(codePoint); 6102 } 6103 6104 /** 6105 * Determines if the specified character is permissible as the 6106 * first character in a Unicode identifier. 6107 * <p> 6108 * A character may start a Unicode identifier if and only if 6109 * one of the following conditions is true: 6110 * <ul> 6111 * <li> {@link #isLetter(char) isLetter(ch)} returns {@code true} 6112 * <li> {@link #getType(char) getType(ch)} returns 6113 * {@code LETTER_NUMBER}. 6114 * </ul> 6115 * 6116 * <p><b>Note:</b> This method cannot handle <a 6117 * href="#supplementary"> supplementary characters</a>. To support 6118 * all Unicode characters, including supplementary characters, use 6119 * the {@link #isUnicodeIdentifierStart(int)} method. 6120 * 6121 * @param ch the character to be tested. 6122 * @return {@code true} if the character may start a Unicode 6123 * identifier; {@code false} otherwise. 6124 * @see Character#isJavaIdentifierStart(char) 6125 * @see Character#isLetter(char) 6126 * @see Character#isUnicodeIdentifierPart(char) 6127 * @since 1.1 6128 */ 6129 public static boolean isUnicodeIdentifierStart(char ch) { 6130 return isUnicodeIdentifierStart((int)ch); 6131 } 6132 6133 /** 6134 * Determines if the specified character (Unicode code point) is permissible as the 6135 * first character in a Unicode identifier. 6136 * <p> 6137 * A character may start a Unicode identifier if and only if 6138 * one of the following conditions is true: 6139 * <ul> 6140 * <li> {@link #isLetter(int) isLetter(codePoint)} 6141 * returns {@code true} 6142 * <li> {@link #getType(int) getType(codePoint)} 6143 * returns {@code LETTER_NUMBER}. 6144 * </ul> 6145 * @param codePoint the character (Unicode code point) to be tested. 6146 * @return {@code true} if the character may start a Unicode 6147 * identifier; {@code false} otherwise. 6148 * @see Character#isJavaIdentifierStart(int) 6149 * @see Character#isLetter(int) 6150 * @see Character#isUnicodeIdentifierPart(int) 6151 * @since 1.5 6152 */ 6153 public static boolean isUnicodeIdentifierStart(int codePoint) { 6154 return CharacterData.of(codePoint).isUnicodeIdentifierStart(codePoint); 6155 } 6156 6157 /** 6158 * Determines if the specified character may be part of a Unicode 6159 * identifier as other than the first character. 6160 * <p> 6161 * A character may be part of a Unicode identifier if and only if 6162 * one of the following statements is true: 6163 * <ul> 6164 * <li> it is a letter 6165 * <li> it is a connecting punctuation character (such as {@code '_'}) 6166 * <li> it is a digit 6167 * <li> it is a numeric letter (such as a Roman numeral character) 6168 * <li> it is a combining mark 6169 * <li> it is a non-spacing mark 6170 * <li> {@code isIdentifierIgnorable} returns 6171 * {@code true} for this character. 6172 * </ul> 6173 * 6174 * <p><b>Note:</b> This method cannot handle <a 6175 * href="#supplementary"> supplementary characters</a>. To support 6176 * all Unicode characters, including supplementary characters, use 6177 * the {@link #isUnicodeIdentifierPart(int)} method. 6178 * 6179 * @param ch the character to be tested. 6180 * @return {@code true} if the character may be part of a 6181 * Unicode identifier; {@code false} otherwise. 6182 * @see Character#isIdentifierIgnorable(char) 6183 * @see Character#isJavaIdentifierPart(char) 6184 * @see Character#isLetterOrDigit(char) 6185 * @see Character#isUnicodeIdentifierStart(char) 6186 * @since 1.1 6187 */ 6188 public static boolean isUnicodeIdentifierPart(char ch) { 6189 return isUnicodeIdentifierPart((int)ch); 6190 } 6191 6192 /** 6193 * Determines if the specified character (Unicode code point) may be part of a Unicode 6194 * identifier as other than the first character. 6195 * <p> 6196 * A character may be part of a Unicode identifier if and only if 6197 * one of the following statements is true: 6198 * <ul> 6199 * <li> it is a letter 6200 * <li> it is a connecting punctuation character (such as {@code '_'}) 6201 * <li> it is a digit 6202 * <li> it is a numeric letter (such as a Roman numeral character) 6203 * <li> it is a combining mark 6204 * <li> it is a non-spacing mark 6205 * <li> {@code isIdentifierIgnorable} returns 6206 * {@code true} for this character. 6207 * </ul> 6208 * @param codePoint the character (Unicode code point) to be tested. 6209 * @return {@code true} if the character may be part of a 6210 * Unicode identifier; {@code false} otherwise. 6211 * @see Character#isIdentifierIgnorable(int) 6212 * @see Character#isJavaIdentifierPart(int) 6213 * @see Character#isLetterOrDigit(int) 6214 * @see Character#isUnicodeIdentifierStart(int) 6215 * @since 1.5 6216 */ 6217 public static boolean isUnicodeIdentifierPart(int codePoint) { 6218 return CharacterData.of(codePoint).isUnicodeIdentifierPart(codePoint); 6219 } 6220 6221 /** 6222 * Determines if the specified character should be regarded as 6223 * an ignorable character in a Java identifier or a Unicode identifier. 6224 * <p> 6225 * The following Unicode characters are ignorable in a Java identifier 6226 * or a Unicode identifier: 6227 * <ul> 6228 * <li>ISO control characters that are not whitespace 6229 * <ul> 6230 * <li>{@code '\u005Cu0000'} through {@code '\u005Cu0008'} 6231 * <li>{@code '\u005Cu000E'} through {@code '\u005Cu001B'} 6232 * <li>{@code '\u005Cu007F'} through {@code '\u005Cu009F'} 6233 * </ul> 6234 * 6235 * <li>all characters that have the {@code FORMAT} general 6236 * category value 6237 * </ul> 6238 * 6239 * <p><b>Note:</b> This method cannot handle <a 6240 * href="#supplementary"> supplementary characters</a>. To support 6241 * all Unicode characters, including supplementary characters, use 6242 * the {@link #isIdentifierIgnorable(int)} method. 6243 * 6244 * @param ch the character to be tested. 6245 * @return {@code true} if the character is an ignorable control 6246 * character that may be part of a Java or Unicode identifier; 6247 * {@code false} otherwise. 6248 * @see Character#isJavaIdentifierPart(char) 6249 * @see Character#isUnicodeIdentifierPart(char) 6250 * @since 1.1 6251 */ 6252 public static boolean isIdentifierIgnorable(char ch) { 6253 return isIdentifierIgnorable((int)ch); 6254 } 6255 6256 /** 6257 * Determines if the specified character (Unicode code point) should be regarded as 6258 * an ignorable character in a Java identifier or a Unicode identifier. 6259 * <p> 6260 * The following Unicode characters are ignorable in a Java identifier 6261 * or a Unicode identifier: 6262 * <ul> 6263 * <li>ISO control characters that are not whitespace 6264 * <ul> 6265 * <li>{@code '\u005Cu0000'} through {@code '\u005Cu0008'} 6266 * <li>{@code '\u005Cu000E'} through {@code '\u005Cu001B'} 6267 * <li>{@code '\u005Cu007F'} through {@code '\u005Cu009F'} 6268 * </ul> 6269 * 6270 * <li>all characters that have the {@code FORMAT} general 6271 * category value 6272 * </ul> 6273 * 6274 * @param codePoint the character (Unicode code point) to be tested. 6275 * @return {@code true} if the character is an ignorable control 6276 * character that may be part of a Java or Unicode identifier; 6277 * {@code false} otherwise. 6278 * @see Character#isJavaIdentifierPart(int) 6279 * @see Character#isUnicodeIdentifierPart(int) 6280 * @since 1.5 6281 */ 6282 public static boolean isIdentifierIgnorable(int codePoint) { 6283 return CharacterData.of(codePoint).isIdentifierIgnorable(codePoint); 6284 } 6285 6286 /** 6287 * Converts the character argument to lowercase using case 6288 * mapping information from the UnicodeData file. 6289 * <p> 6290 * Note that 6291 * {@code Character.isLowerCase(Character.toLowerCase(ch))} 6292 * does not always return {@code true} for some ranges of 6293 * characters, particularly those that are symbols or ideographs. 6294 * 6295 * <p>In general, {@link String#toLowerCase()} should be used to map 6296 * characters to lowercase. {@code String} case mapping methods 6297 * have several benefits over {@code Character} case mapping methods. 6298 * {@code String} case mapping methods can perform locale-sensitive 6299 * mappings, context-sensitive mappings, and 1:M character mappings, whereas 6300 * the {@code Character} case mapping methods cannot. 6301 * 6302 * <p><b>Note:</b> This method cannot handle <a 6303 * href="#supplementary"> supplementary characters</a>. To support 6304 * all Unicode characters, including supplementary characters, use 6305 * the {@link #toLowerCase(int)} method. 6306 * 6307 * @param ch the character to be converted. 6308 * @return the lowercase equivalent of the character, if any; 6309 * otherwise, the character itself. 6310 * @see Character#isLowerCase(char) 6311 * @see String#toLowerCase() 6312 */ 6313 public static char toLowerCase(char ch) { 6314 return (char)toLowerCase((int)ch); 6315 } 6316 6317 /** 6318 * Converts the character (Unicode code point) argument to 6319 * lowercase using case mapping information from the UnicodeData 6320 * file. 6321 * 6322 * <p> Note that 6323 * {@code Character.isLowerCase(Character.toLowerCase(codePoint))} 6324 * does not always return {@code true} for some ranges of 6325 * characters, particularly those that are symbols or ideographs. 6326 * 6327 * <p>In general, {@link String#toLowerCase()} should be used to map 6328 * characters to lowercase. {@code String} case mapping methods 6329 * have several benefits over {@code Character} case mapping methods. 6330 * {@code String} case mapping methods can perform locale-sensitive 6331 * mappings, context-sensitive mappings, and 1:M character mappings, whereas 6332 * the {@code Character} case mapping methods cannot. 6333 * 6334 * @param codePoint the character (Unicode code point) to be converted. 6335 * @return the lowercase equivalent of the character (Unicode code 6336 * point), if any; otherwise, the character itself. 6337 * @see Character#isLowerCase(int) 6338 * @see String#toLowerCase() 6339 * 6340 * @since 1.5 6341 */ 6342 public static int toLowerCase(int codePoint) { 6343 return CharacterData.of(codePoint).toLowerCase(codePoint); 6344 } 6345 6346 /** 6347 * Converts the character argument to uppercase using case mapping 6348 * information from the UnicodeData file. 6349 * <p> 6350 * Note that 6351 * {@code Character.isUpperCase(Character.toUpperCase(ch))} 6352 * does not always return {@code true} for some ranges of 6353 * characters, particularly those that are symbols or ideographs. 6354 * 6355 * <p>In general, {@link String#toUpperCase()} should be used to map 6356 * characters to uppercase. {@code String} case mapping methods 6357 * have several benefits over {@code Character} case mapping methods. 6358 * {@code String} case mapping methods can perform locale-sensitive 6359 * mappings, context-sensitive mappings, and 1:M character mappings, whereas 6360 * the {@code Character} case mapping methods cannot. 6361 * 6362 * <p><b>Note:</b> This method cannot handle <a 6363 * href="#supplementary"> supplementary characters</a>. To support 6364 * all Unicode characters, including supplementary characters, use 6365 * the {@link #toUpperCase(int)} method. 6366 * 6367 * @param ch the character to be converted. 6368 * @return the uppercase equivalent of the character, if any; 6369 * otherwise, the character itself. 6370 * @see Character#isUpperCase(char) 6371 * @see String#toUpperCase() 6372 */ 6373 public static char toUpperCase(char ch) { 6374 return (char)toUpperCase((int)ch); 6375 } 6376 6377 /** 6378 * Converts the character (Unicode code point) argument to 6379 * uppercase using case mapping information from the UnicodeData 6380 * file. 6381 * 6382 * <p>Note that 6383 * {@code Character.isUpperCase(Character.toUpperCase(codePoint))} 6384 * does not always return {@code true} for some ranges of 6385 * characters, particularly those that are symbols or ideographs. 6386 * 6387 * <p>In general, {@link String#toUpperCase()} should be used to map 6388 * characters to uppercase. {@code String} case mapping methods 6389 * have several benefits over {@code Character} case mapping methods. 6390 * {@code String} case mapping methods can perform locale-sensitive 6391 * mappings, context-sensitive mappings, and 1:M character mappings, whereas 6392 * the {@code Character} case mapping methods cannot. 6393 * 6394 * @param codePoint the character (Unicode code point) to be converted. 6395 * @return the uppercase equivalent of the character, if any; 6396 * otherwise, the character itself. 6397 * @see Character#isUpperCase(int) 6398 * @see String#toUpperCase() 6399 * 6400 * @since 1.5 6401 */ 6402 public static int toUpperCase(int codePoint) { 6403 return CharacterData.of(codePoint).toUpperCase(codePoint); 6404 } 6405 6406 /** 6407 * Converts the character argument to titlecase using case mapping 6408 * information from the UnicodeData file. If a character has no 6409 * explicit titlecase mapping and is not itself a titlecase char 6410 * according to UnicodeData, then the uppercase mapping is 6411 * returned as an equivalent titlecase mapping. If the 6412 * {@code char} argument is already a titlecase 6413 * {@code char}, the same {@code char} value will be 6414 * returned. 6415 * <p> 6416 * Note that 6417 * {@code Character.isTitleCase(Character.toTitleCase(ch))} 6418 * does not always return {@code true} for some ranges of 6419 * characters. 6420 * 6421 * <p><b>Note:</b> This method cannot handle <a 6422 * href="#supplementary"> supplementary characters</a>. To support 6423 * all Unicode characters, including supplementary characters, use 6424 * the {@link #toTitleCase(int)} method. 6425 * 6426 * @param ch the character to be converted. 6427 * @return the titlecase equivalent of the character, if any; 6428 * otherwise, the character itself. 6429 * @see Character#isTitleCase(char) 6430 * @see Character#toLowerCase(char) 6431 * @see Character#toUpperCase(char) 6432 * @since 1.0.2 6433 */ 6434 public static char toTitleCase(char ch) { 6435 return (char)toTitleCase((int)ch); 6436 } 6437 6438 /** 6439 * Converts the character (Unicode code point) argument to titlecase using case mapping 6440 * information from the UnicodeData file. If a character has no 6441 * explicit titlecase mapping and is not itself a titlecase char 6442 * according to UnicodeData, then the uppercase mapping is 6443 * returned as an equivalent titlecase mapping. If the 6444 * character argument is already a titlecase 6445 * character, the same character value will be 6446 * returned. 6447 * 6448 * <p>Note that 6449 * {@code Character.isTitleCase(Character.toTitleCase(codePoint))} 6450 * does not always return {@code true} for some ranges of 6451 * characters. 6452 * 6453 * @param codePoint the character (Unicode code point) to be converted. 6454 * @return the titlecase equivalent of the character, if any; 6455 * otherwise, the character itself. 6456 * @see Character#isTitleCase(int) 6457 * @see Character#toLowerCase(int) 6458 * @see Character#toUpperCase(int) 6459 * @since 1.5 6460 */ 6461 public static int toTitleCase(int codePoint) { 6462 return CharacterData.of(codePoint).toTitleCase(codePoint); 6463 } 6464 6465 /** 6466 * Returns the numeric value of the character {@code ch} in the 6467 * specified radix. 6468 * <p> 6469 * If the radix is not in the range {@code MIN_RADIX} ≤ 6470 * {@code radix} ≤ {@code MAX_RADIX} or if the 6471 * value of {@code ch} is not a valid digit in the specified 6472 * radix, {@code -1} is returned. A character is a valid digit 6473 * if at least one of the following is true: 6474 * <ul> 6475 * <li>The method {@code isDigit} is {@code true} of the character 6476 * and the Unicode decimal digit value of the character (or its 6477 * single-character decomposition) is less than the specified radix. 6478 * In this case the decimal digit value is returned. 6479 * <li>The character is one of the uppercase Latin letters 6480 * {@code 'A'} through {@code 'Z'} and its code is less than 6481 * {@code radix + 'A' - 10}. 6482 * In this case, {@code ch - 'A' + 10} 6483 * is returned. 6484 * <li>The character is one of the lowercase Latin letters 6485 * {@code 'a'} through {@code 'z'} and its code is less than 6486 * {@code radix + 'a' - 10}. 6487 * In this case, {@code ch - 'a' + 10} 6488 * is returned. 6489 * <li>The character is one of the fullwidth uppercase Latin letters A 6490 * ({@code '\u005CuFF21'}) through Z ({@code '\u005CuFF3A'}) 6491 * and its code is less than 6492 * {@code radix + '\u005CuFF21' - 10}. 6493 * In this case, {@code ch - '\u005CuFF21' + 10} 6494 * is returned. 6495 * <li>The character is one of the fullwidth lowercase Latin letters a 6496 * ({@code '\u005CuFF41'}) through z ({@code '\u005CuFF5A'}) 6497 * and its code is less than 6498 * {@code radix + '\u005CuFF41' - 10}. 6499 * In this case, {@code ch - '\u005CuFF41' + 10} 6500 * is returned. 6501 * </ul> 6502 * 6503 * <p><b>Note:</b> This method cannot handle <a 6504 * href="#supplementary"> supplementary characters</a>. To support 6505 * all Unicode characters, including supplementary characters, use 6506 * the {@link #digit(int, int)} method. 6507 * 6508 * @param ch the character to be converted. 6509 * @param radix the radix. 6510 * @return the numeric value represented by the character in the 6511 * specified radix. 6512 * @see Character#forDigit(int, int) 6513 * @see Character#isDigit(char) 6514 */ 6515 public static int digit(char ch, int radix) { 6516 return digit((int)ch, radix); 6517 } 6518 6519 /** 6520 * Returns the numeric value of the specified character (Unicode 6521 * code point) in the specified radix. 6522 * 6523 * <p>If the radix is not in the range {@code MIN_RADIX} ≤ 6524 * {@code radix} ≤ {@code MAX_RADIX} or if the 6525 * character is not a valid digit in the specified 6526 * radix, {@code -1} is returned. A character is a valid digit 6527 * if at least one of the following is true: 6528 * <ul> 6529 * <li>The method {@link #isDigit(int) isDigit(codePoint)} is {@code true} of the character 6530 * and the Unicode decimal digit value of the character (or its 6531 * single-character decomposition) is less than the specified radix. 6532 * In this case the decimal digit value is returned. 6533 * <li>The character is one of the uppercase Latin letters 6534 * {@code 'A'} through {@code 'Z'} and its code is less than 6535 * {@code radix + 'A' - 10}. 6536 * In this case, {@code codePoint - 'A' + 10} 6537 * is returned. 6538 * <li>The character is one of the lowercase Latin letters 6539 * {@code 'a'} through {@code 'z'} and its code is less than 6540 * {@code radix + 'a' - 10}. 6541 * In this case, {@code codePoint - 'a' + 10} 6542 * is returned. 6543 * <li>The character is one of the fullwidth uppercase Latin letters A 6544 * ({@code '\u005CuFF21'}) through Z ({@code '\u005CuFF3A'}) 6545 * and its code is less than 6546 * {@code radix + '\u005CuFF21' - 10}. 6547 * In this case, 6548 * {@code codePoint - '\u005CuFF21' + 10} 6549 * is returned. 6550 * <li>The character is one of the fullwidth lowercase Latin letters a 6551 * ({@code '\u005CuFF41'}) through z ({@code '\u005CuFF5A'}) 6552 * and its code is less than 6553 * {@code radix + '\u005CuFF41'- 10}. 6554 * In this case, 6555 * {@code codePoint - '\u005CuFF41' + 10} 6556 * is returned. 6557 * </ul> 6558 * 6559 * @param codePoint the character (Unicode code point) to be converted. 6560 * @param radix the radix. 6561 * @return the numeric value represented by the character in the 6562 * specified radix. 6563 * @see Character#forDigit(int, int) 6564 * @see Character#isDigit(int) 6565 * @since 1.5 6566 */ 6567 public static int digit(int codePoint, int radix) { 6568 return CharacterData.of(codePoint).digit(codePoint, radix); 6569 } 6570 6571 /** 6572 * Returns the {@code int} value that the specified Unicode 6573 * character represents. For example, the character 6574 * {@code '\u005Cu216C'} (the roman numeral fifty) will return 6575 * an int with a value of 50. 6576 * <p> 6577 * The letters A-Z in their uppercase ({@code '\u005Cu0041'} through 6578 * {@code '\u005Cu005A'}), lowercase 6579 * ({@code '\u005Cu0061'} through {@code '\u005Cu007A'}), and 6580 * full width variant ({@code '\u005CuFF21'} through 6581 * {@code '\u005CuFF3A'} and {@code '\u005CuFF41'} through 6582 * {@code '\u005CuFF5A'}) forms have numeric values from 10 6583 * through 35. This is independent of the Unicode specification, 6584 * which does not assign numeric values to these {@code char} 6585 * values. 6586 * <p> 6587 * If the character does not have a numeric value, then -1 is returned. 6588 * If the character has a numeric value that cannot be represented as a 6589 * nonnegative integer (for example, a fractional value), then -2 6590 * is returned. 6591 * 6592 * <p><b>Note:</b> This method cannot handle <a 6593 * href="#supplementary"> supplementary characters</a>. To support 6594 * all Unicode characters, including supplementary characters, use 6595 * the {@link #getNumericValue(int)} method. 6596 * 6597 * @param ch the character to be converted. 6598 * @return the numeric value of the character, as a nonnegative {@code int} 6599 * value; -2 if the character has a numeric value that is not a 6600 * nonnegative integer; -1 if the character has no numeric value. 6601 * @see Character#forDigit(int, int) 6602 * @see Character#isDigit(char) 6603 * @since 1.1 6604 */ 6605 public static int getNumericValue(char ch) { 6606 return getNumericValue((int)ch); 6607 } 6608 6609 /** 6610 * Returns the {@code int} value that the specified 6611 * character (Unicode code point) represents. For example, the character 6612 * {@code '\u005Cu216C'} (the Roman numeral fifty) will return 6613 * an {@code int} with a value of 50. 6614 * <p> 6615 * The letters A-Z in their uppercase ({@code '\u005Cu0041'} through 6616 * {@code '\u005Cu005A'}), lowercase 6617 * ({@code '\u005Cu0061'} through {@code '\u005Cu007A'}), and 6618 * full width variant ({@code '\u005CuFF21'} through 6619 * {@code '\u005CuFF3A'} and {@code '\u005CuFF41'} through 6620 * {@code '\u005CuFF5A'}) forms have numeric values from 10 6621 * through 35. This is independent of the Unicode specification, 6622 * which does not assign numeric values to these {@code char} 6623 * values. 6624 * <p> 6625 * If the character does not have a numeric value, then -1 is returned. 6626 * If the character has a numeric value that cannot be represented as a 6627 * nonnegative integer (for example, a fractional value), then -2 6628 * is returned. 6629 * 6630 * @param codePoint the character (Unicode code point) to be converted. 6631 * @return the numeric value of the character, as a nonnegative {@code int} 6632 * value; -2 if the character has a numeric value that is not a 6633 * nonnegative integer; -1 if the character has no numeric value. 6634 * @see Character#forDigit(int, int) 6635 * @see Character#isDigit(int) 6636 * @since 1.5 6637 */ 6638 public static int getNumericValue(int codePoint) { 6639 return CharacterData.of(codePoint).getNumericValue(codePoint); 6640 } 6641 6642 /** 6643 * Determines if the specified character is ISO-LATIN-1 white space. 6644 * This method returns {@code true} for the following five 6645 * characters only: 6646 * <table summary="truechars"> 6647 * <tr><td>{@code '\t'}</td> <td>{@code U+0009}</td> 6648 * <td>{@code HORIZONTAL TABULATION}</td></tr> 6649 * <tr><td>{@code '\n'}</td> <td>{@code U+000A}</td> 6650 * <td>{@code NEW LINE}</td></tr> 6651 * <tr><td>{@code '\f'}</td> <td>{@code U+000C}</td> 6652 * <td>{@code FORM FEED}</td></tr> 6653 * <tr><td>{@code '\r'}</td> <td>{@code U+000D}</td> 6654 * <td>{@code CARRIAGE RETURN}</td></tr> 6655 * <tr><td>{@code ' '}</td> <td>{@code U+0020}</td> 6656 * <td>{@code SPACE}</td></tr> 6657 * </table> 6658 * 6659 * @param ch the character to be tested. 6660 * @return {@code true} if the character is ISO-LATIN-1 white 6661 * space; {@code false} otherwise. 6662 * @see Character#isSpaceChar(char) 6663 * @see Character#isWhitespace(char) 6664 * @deprecated Replaced by isWhitespace(char). 6665 */ 6666 @Deprecated 6667 public static boolean isSpace(char ch) { 6668 return (ch <= 0x0020) && 6669 (((((1L << 0x0009) | 6670 (1L << 0x000A) | 6671 (1L << 0x000C) | 6672 (1L << 0x000D) | 6673 (1L << 0x0020)) >> ch) & 1L) != 0); 6674 } 6675 6676 6677 /** 6678 * Determines if the specified character is a Unicode space character. 6679 * A character is considered to be a space character if and only if 6680 * it is specified to be a space character by the Unicode Standard. This 6681 * method returns true if the character's general category type is any of 6682 * the following: 6683 * <ul> 6684 * <li> {@code SPACE_SEPARATOR} 6685 * <li> {@code LINE_SEPARATOR} 6686 * <li> {@code PARAGRAPH_SEPARATOR} 6687 * </ul> 6688 * 6689 * <p><b>Note:</b> This method cannot handle <a 6690 * href="#supplementary"> supplementary characters</a>. To support 6691 * all Unicode characters, including supplementary characters, use 6692 * the {@link #isSpaceChar(int)} method. 6693 * 6694 * @param ch the character to be tested. 6695 * @return {@code true} if the character is a space character; 6696 * {@code false} otherwise. 6697 * @see Character#isWhitespace(char) 6698 * @since 1.1 6699 */ 6700 public static boolean isSpaceChar(char ch) { 6701 return isSpaceChar((int)ch); 6702 } 6703 6704 /** 6705 * Determines if the specified character (Unicode code point) is a 6706 * Unicode space character. A character is considered to be a 6707 * space character if and only if it is specified to be a space 6708 * character by the Unicode Standard. This method returns true if 6709 * the character's general category type is any of the following: 6710 * 6711 * <ul> 6712 * <li> {@link #SPACE_SEPARATOR} 6713 * <li> {@link #LINE_SEPARATOR} 6714 * <li> {@link #PARAGRAPH_SEPARATOR} 6715 * </ul> 6716 * 6717 * @param codePoint the character (Unicode code point) to be tested. 6718 * @return {@code true} if the character is a space character; 6719 * {@code false} otherwise. 6720 * @see Character#isWhitespace(int) 6721 * @since 1.5 6722 */ 6723 public static boolean isSpaceChar(int codePoint) { 6724 return ((((1 << Character.SPACE_SEPARATOR) | 6725 (1 << Character.LINE_SEPARATOR) | 6726 (1 << Character.PARAGRAPH_SEPARATOR)) >> getType(codePoint)) & 1) 6727 != 0; 6728 } 6729 6730 /** 6731 * Determines if the specified character is white space according to Java. 6732 * A character is a Java whitespace character if and only if it satisfies 6733 * one of the following criteria: 6734 * <ul> 6735 * <li> It is a Unicode space character ({@code SPACE_SEPARATOR}, 6736 * {@code LINE_SEPARATOR}, or {@code PARAGRAPH_SEPARATOR}) 6737 * but is not also a non-breaking space ({@code '\u005Cu00A0'}, 6738 * {@code '\u005Cu2007'}, {@code '\u005Cu202F'}). 6739 * <li> It is {@code '\u005Ct'}, U+0009 HORIZONTAL TABULATION. 6740 * <li> It is {@code '\u005Cn'}, U+000A LINE FEED. 6741 * <li> It is {@code '\u005Cu000B'}, U+000B VERTICAL TABULATION. 6742 * <li> It is {@code '\u005Cf'}, U+000C FORM FEED. 6743 * <li> It is {@code '\u005Cr'}, U+000D CARRIAGE RETURN. 6744 * <li> It is {@code '\u005Cu001C'}, U+001C FILE SEPARATOR. 6745 * <li> It is {@code '\u005Cu001D'}, U+001D GROUP SEPARATOR. 6746 * <li> It is {@code '\u005Cu001E'}, U+001E RECORD SEPARATOR. 6747 * <li> It is {@code '\u005Cu001F'}, U+001F UNIT SEPARATOR. 6748 * </ul> 6749 * 6750 * <p><b>Note:</b> This method cannot handle <a 6751 * href="#supplementary"> supplementary characters</a>. To support 6752 * all Unicode characters, including supplementary characters, use 6753 * the {@link #isWhitespace(int)} method. 6754 * 6755 * @param ch the character to be tested. 6756 * @return {@code true} if the character is a Java whitespace 6757 * character; {@code false} otherwise. 6758 * @see Character#isSpaceChar(char) 6759 * @since 1.1 6760 */ 6761 public static boolean isWhitespace(char ch) { 6762 return isWhitespace((int)ch); 6763 } 6764 6765 /** 6766 * Determines if the specified character (Unicode code point) is 6767 * white space according to Java. A character is a Java 6768 * whitespace character if and only if it satisfies one of the 6769 * following criteria: 6770 * <ul> 6771 * <li> It is a Unicode space character ({@link #SPACE_SEPARATOR}, 6772 * {@link #LINE_SEPARATOR}, or {@link #PARAGRAPH_SEPARATOR}) 6773 * but is not also a non-breaking space ({@code '\u005Cu00A0'}, 6774 * {@code '\u005Cu2007'}, {@code '\u005Cu202F'}). 6775 * <li> It is {@code '\u005Ct'}, U+0009 HORIZONTAL TABULATION. 6776 * <li> It is {@code '\u005Cn'}, U+000A LINE FEED. 6777 * <li> It is {@code '\u005Cu000B'}, U+000B VERTICAL TABULATION. 6778 * <li> It is {@code '\u005Cf'}, U+000C FORM FEED. 6779 * <li> It is {@code '\u005Cr'}, U+000D CARRIAGE RETURN. 6780 * <li> It is {@code '\u005Cu001C'}, U+001C FILE SEPARATOR. 6781 * <li> It is {@code '\u005Cu001D'}, U+001D GROUP SEPARATOR. 6782 * <li> It is {@code '\u005Cu001E'}, U+001E RECORD SEPARATOR. 6783 * <li> It is {@code '\u005Cu001F'}, U+001F UNIT SEPARATOR. 6784 * </ul> 6785 * 6786 * @param codePoint the character (Unicode code point) to be tested. 6787 * @return {@code true} if the character is a Java whitespace 6788 * character; {@code false} otherwise. 6789 * @see Character#isSpaceChar(int) 6790 * @since 1.5 6791 */ 6792 public static boolean isWhitespace(int codePoint) { 6793 return CharacterData.of(codePoint).isWhitespace(codePoint); 6794 } 6795 6796 /** 6797 * Determines if the specified character is an ISO control 6798 * character. A character is considered to be an ISO control 6799 * character if its code is in the range {@code '\u005Cu0000'} 6800 * through {@code '\u005Cu001F'} or in the range 6801 * {@code '\u005Cu007F'} through {@code '\u005Cu009F'}. 6802 * 6803 * <p><b>Note:</b> This method cannot handle <a 6804 * href="#supplementary"> supplementary characters</a>. To support 6805 * all Unicode characters, including supplementary characters, use 6806 * the {@link #isISOControl(int)} method. 6807 * 6808 * @param ch the character to be tested. 6809 * @return {@code true} if the character is an ISO control character; 6810 * {@code false} otherwise. 6811 * 6812 * @see Character#isSpaceChar(char) 6813 * @see Character#isWhitespace(char) 6814 * @since 1.1 6815 */ 6816 public static boolean isISOControl(char ch) { 6817 return isISOControl((int)ch); 6818 } 6819 6820 /** 6821 * Determines if the referenced character (Unicode code point) is an ISO control 6822 * character. A character is considered to be an ISO control 6823 * character if its code is in the range {@code '\u005Cu0000'} 6824 * through {@code '\u005Cu001F'} or in the range 6825 * {@code '\u005Cu007F'} through {@code '\u005Cu009F'}. 6826 * 6827 * @param codePoint the character (Unicode code point) to be tested. 6828 * @return {@code true} if the character is an ISO control character; 6829 * {@code false} otherwise. 6830 * @see Character#isSpaceChar(int) 6831 * @see Character#isWhitespace(int) 6832 * @since 1.5 6833 */ 6834 public static boolean isISOControl(int codePoint) { 6835 // Optimized form of: 6836 // (codePoint >= 0x00 && codePoint <= 0x1F) || 6837 // (codePoint >= 0x7F && codePoint <= 0x9F); 6838 return codePoint <= 0x9F && 6839 (codePoint >= 0x7F || (codePoint >>> 5 == 0)); 6840 } 6841 6842 /** 6843 * Returns a value indicating a character's general category. 6844 * 6845 * <p><b>Note:</b> This method cannot handle <a 6846 * href="#supplementary"> supplementary characters</a>. To support 6847 * all Unicode characters, including supplementary characters, use 6848 * the {@link #getType(int)} method. 6849 * 6850 * @param ch the character to be tested. 6851 * @return a value of type {@code int} representing the 6852 * character's general category. 6853 * @see Character#COMBINING_SPACING_MARK 6854 * @see Character#CONNECTOR_PUNCTUATION 6855 * @see Character#CONTROL 6856 * @see Character#CURRENCY_SYMBOL 6857 * @see Character#DASH_PUNCTUATION 6858 * @see Character#DECIMAL_DIGIT_NUMBER 6859 * @see Character#ENCLOSING_MARK 6860 * @see Character#END_PUNCTUATION 6861 * @see Character#FINAL_QUOTE_PUNCTUATION 6862 * @see Character#FORMAT 6863 * @see Character#INITIAL_QUOTE_PUNCTUATION 6864 * @see Character#LETTER_NUMBER 6865 * @see Character#LINE_SEPARATOR 6866 * @see Character#LOWERCASE_LETTER 6867 * @see Character#MATH_SYMBOL 6868 * @see Character#MODIFIER_LETTER 6869 * @see Character#MODIFIER_SYMBOL 6870 * @see Character#NON_SPACING_MARK 6871 * @see Character#OTHER_LETTER 6872 * @see Character#OTHER_NUMBER 6873 * @see Character#OTHER_PUNCTUATION 6874 * @see Character#OTHER_SYMBOL 6875 * @see Character#PARAGRAPH_SEPARATOR 6876 * @see Character#PRIVATE_USE 6877 * @see Character#SPACE_SEPARATOR 6878 * @see Character#START_PUNCTUATION 6879 * @see Character#SURROGATE 6880 * @see Character#TITLECASE_LETTER 6881 * @see Character#UNASSIGNED 6882 * @see Character#UPPERCASE_LETTER 6883 * @since 1.1 6884 */ 6885 public static int getType(char ch) { 6886 return getType((int)ch); 6887 } 6888 6889 /** 6890 * Returns a value indicating a character's general category. 6891 * 6892 * @param codePoint the character (Unicode code point) to be tested. 6893 * @return a value of type {@code int} representing the 6894 * character's general category. 6895 * @see Character#COMBINING_SPACING_MARK COMBINING_SPACING_MARK 6896 * @see Character#CONNECTOR_PUNCTUATION CONNECTOR_PUNCTUATION 6897 * @see Character#CONTROL CONTROL 6898 * @see Character#CURRENCY_SYMBOL CURRENCY_SYMBOL 6899 * @see Character#DASH_PUNCTUATION DASH_PUNCTUATION 6900 * @see Character#DECIMAL_DIGIT_NUMBER DECIMAL_DIGIT_NUMBER 6901 * @see Character#ENCLOSING_MARK ENCLOSING_MARK 6902 * @see Character#END_PUNCTUATION END_PUNCTUATION 6903 * @see Character#FINAL_QUOTE_PUNCTUATION FINAL_QUOTE_PUNCTUATION 6904 * @see Character#FORMAT FORMAT 6905 * @see Character#INITIAL_QUOTE_PUNCTUATION INITIAL_QUOTE_PUNCTUATION 6906 * @see Character#LETTER_NUMBER LETTER_NUMBER 6907 * @see Character#LINE_SEPARATOR LINE_SEPARATOR 6908 * @see Character#LOWERCASE_LETTER LOWERCASE_LETTER 6909 * @see Character#MATH_SYMBOL MATH_SYMBOL 6910 * @see Character#MODIFIER_LETTER MODIFIER_LETTER 6911 * @see Character#MODIFIER_SYMBOL MODIFIER_SYMBOL 6912 * @see Character#NON_SPACING_MARK NON_SPACING_MARK 6913 * @see Character#OTHER_LETTER OTHER_LETTER 6914 * @see Character#OTHER_NUMBER OTHER_NUMBER 6915 * @see Character#OTHER_PUNCTUATION OTHER_PUNCTUATION 6916 * @see Character#OTHER_SYMBOL OTHER_SYMBOL 6917 * @see Character#PARAGRAPH_SEPARATOR PARAGRAPH_SEPARATOR 6918 * @see Character#PRIVATE_USE PRIVATE_USE 6919 * @see Character#SPACE_SEPARATOR SPACE_SEPARATOR 6920 * @see Character#START_PUNCTUATION START_PUNCTUATION 6921 * @see Character#SURROGATE SURROGATE 6922 * @see Character#TITLECASE_LETTER TITLECASE_LETTER 6923 * @see Character#UNASSIGNED UNASSIGNED 6924 * @see Character#UPPERCASE_LETTER UPPERCASE_LETTER 6925 * @since 1.5 6926 */ 6927 public static int getType(int codePoint) { 6928 return CharacterData.of(codePoint).getType(codePoint); 6929 } 6930 6931 /** 6932 * Determines the character representation for a specific digit in 6933 * the specified radix. If the value of {@code radix} is not a 6934 * valid radix, or the value of {@code digit} is not a valid 6935 * digit in the specified radix, the null character 6936 * ({@code '\u005Cu0000'}) is returned. 6937 * <p> 6938 * The {@code radix} argument is valid if it is greater than or 6939 * equal to {@code MIN_RADIX} and less than or equal to 6940 * {@code MAX_RADIX}. The {@code digit} argument is valid if 6941 * {@code 0 <= digit < radix}. 6942 * <p> 6943 * If the digit is less than 10, then 6944 * {@code '0' + digit} is returned. Otherwise, the value 6945 * {@code 'a' + digit - 10} is returned. 6946 * 6947 * @param digit the number to convert to a character. 6948 * @param radix the radix. 6949 * @return the {@code char} representation of the specified digit 6950 * in the specified radix. 6951 * @see Character#MIN_RADIX 6952 * @see Character#MAX_RADIX 6953 * @see Character#digit(char, int) 6954 */ 6955 public static char forDigit(int digit, int radix) { 6956 if ((digit >= radix) || (digit < 0)) { 6957 return '\0'; 6958 } 6959 if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) { 6960 return '\0'; 6961 } 6962 if (digit < 10) { 6963 return (char)('0' + digit); 6964 } 6965 return (char)('a' - 10 + digit); 6966 } 6967 6968 /** 6969 * Returns the Unicode directionality property for the given 6970 * character. Character directionality is used to calculate the 6971 * visual ordering of text. The directionality value of undefined 6972 * {@code char} values is {@code DIRECTIONALITY_UNDEFINED}. 6973 * 6974 * <p><b>Note:</b> This method cannot handle <a 6975 * href="#supplementary"> supplementary characters</a>. To support 6976 * all Unicode characters, including supplementary characters, use 6977 * the {@link #getDirectionality(int)} method. 6978 * 6979 * @param ch {@code char} for which the directionality property 6980 * is requested. 6981 * @return the directionality property of the {@code char} value. 6982 * 6983 * @see Character#DIRECTIONALITY_UNDEFINED 6984 * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT 6985 * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT 6986 * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC 6987 * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER 6988 * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR 6989 * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR 6990 * @see Character#DIRECTIONALITY_ARABIC_NUMBER 6991 * @see Character#DIRECTIONALITY_COMMON_NUMBER_SEPARATOR 6992 * @see Character#DIRECTIONALITY_NONSPACING_MARK 6993 * @see Character#DIRECTIONALITY_BOUNDARY_NEUTRAL 6994 * @see Character#DIRECTIONALITY_PARAGRAPH_SEPARATOR 6995 * @see Character#DIRECTIONALITY_SEGMENT_SEPARATOR 6996 * @see Character#DIRECTIONALITY_WHITESPACE 6997 * @see Character#DIRECTIONALITY_OTHER_NEUTRALS 6998 * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING 6999 * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE 7000 * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING 7001 * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE 7002 * @see Character#DIRECTIONALITY_POP_DIRECTIONAL_FORMAT 7003 * @since 1.4 7004 */ 7005 public static byte getDirectionality(char ch) { 7006 return getDirectionality((int)ch); 7007 } 7008 7009 /** 7010 * Returns the Unicode directionality property for the given 7011 * character (Unicode code point). Character directionality is 7012 * used to calculate the visual ordering of text. The 7013 * directionality value of undefined character is {@link 7014 * #DIRECTIONALITY_UNDEFINED}. 7015 * 7016 * @param codePoint the character (Unicode code point) for which 7017 * the directionality property is requested. 7018 * @return the directionality property of the character. 7019 * 7020 * @see Character#DIRECTIONALITY_UNDEFINED DIRECTIONALITY_UNDEFINED 7021 * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT DIRECTIONALITY_LEFT_TO_RIGHT 7022 * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT DIRECTIONALITY_RIGHT_TO_LEFT 7023 * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC 7024 * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER DIRECTIONALITY_EUROPEAN_NUMBER 7025 * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR 7026 * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR 7027 * @see Character#DIRECTIONALITY_ARABIC_NUMBER DIRECTIONALITY_ARABIC_NUMBER 7028 * @see Character#DIRECTIONALITY_COMMON_NUMBER_SEPARATOR DIRECTIONALITY_COMMON_NUMBER_SEPARATOR 7029 * @see Character#DIRECTIONALITY_NONSPACING_MARK DIRECTIONALITY_NONSPACING_MARK 7030 * @see Character#DIRECTIONALITY_BOUNDARY_NEUTRAL DIRECTIONALITY_BOUNDARY_NEUTRAL 7031 * @see Character#DIRECTIONALITY_PARAGRAPH_SEPARATOR DIRECTIONALITY_PARAGRAPH_SEPARATOR 7032 * @see Character#DIRECTIONALITY_SEGMENT_SEPARATOR DIRECTIONALITY_SEGMENT_SEPARATOR 7033 * @see Character#DIRECTIONALITY_WHITESPACE DIRECTIONALITY_WHITESPACE 7034 * @see Character#DIRECTIONALITY_OTHER_NEUTRALS DIRECTIONALITY_OTHER_NEUTRALS 7035 * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING 7036 * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE 7037 * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING 7038 * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE 7039 * @see Character#DIRECTIONALITY_POP_DIRECTIONAL_FORMAT DIRECTIONALITY_POP_DIRECTIONAL_FORMAT 7040 * @since 1.5 7041 */ 7042 public static byte getDirectionality(int codePoint) { 7043 return CharacterData.of(codePoint).getDirectionality(codePoint); 7044 } 7045 7046 /** 7047 * Determines whether the character is mirrored according to the 7048 * Unicode specification. Mirrored characters should have their 7049 * glyphs horizontally mirrored when displayed in text that is 7050 * right-to-left. For example, {@code '\u005Cu0028'} LEFT 7051 * PARENTHESIS is semantically defined to be an <i>opening 7052 * parenthesis</i>. This will appear as a "(" in text that is 7053 * left-to-right but as a ")" in text that is right-to-left. 7054 * 7055 * <p><b>Note:</b> This method cannot handle <a 7056 * href="#supplementary"> supplementary characters</a>. To support 7057 * all Unicode characters, including supplementary characters, use 7058 * the {@link #isMirrored(int)} method. 7059 * 7060 * @param ch {@code char} for which the mirrored property is requested 7061 * @return {@code true} if the char is mirrored, {@code false} 7062 * if the {@code char} is not mirrored or is not defined. 7063 * @since 1.4 7064 */ 7065 public static boolean isMirrored(char ch) { 7066 return isMirrored((int)ch); 7067 } 7068 7069 /** 7070 * Determines whether the specified character (Unicode code point) 7071 * is mirrored according to the Unicode specification. Mirrored 7072 * characters should have their glyphs horizontally mirrored when 7073 * displayed in text that is right-to-left. For example, 7074 * {@code '\u005Cu0028'} LEFT PARENTHESIS is semantically 7075 * defined to be an <i>opening parenthesis</i>. This will appear 7076 * as a "(" in text that is left-to-right but as a ")" in text 7077 * that is right-to-left. 7078 * 7079 * @param codePoint the character (Unicode code point) to be tested. 7080 * @return {@code true} if the character is mirrored, {@code false} 7081 * if the character is not mirrored or is not defined. 7082 * @since 1.5 7083 */ 7084 public static boolean isMirrored(int codePoint) { 7085 return CharacterData.of(codePoint).isMirrored(codePoint); 7086 } 7087 7088 /** 7089 * Compares two {@code Character} objects numerically. 7090 * 7091 * @param anotherCharacter the {@code Character} to be compared. 7092 7093 * @return the value {@code 0} if the argument {@code Character} 7094 * is equal to this {@code Character}; a value less than 7095 * {@code 0} if this {@code Character} is numerically less 7096 * than the {@code Character} argument; and a value greater than 7097 * {@code 0} if this {@code Character} is numerically greater 7098 * than the {@code Character} argument (unsigned comparison). 7099 * Note that this is strictly a numerical comparison; it is not 7100 * locale-dependent. 7101 * @since 1.2 7102 */ 7103 public int compareTo(Character anotherCharacter) { 7104 return compare(this.value, anotherCharacter.value); 7105 } 7106 7107 /** 7108 * Compares two {@code char} values numerically. 7109 * The value returned is identical to what would be returned by: 7110 * <pre> 7111 * Character.valueOf(x).compareTo(Character.valueOf(y)) 7112 * </pre> 7113 * 7114 * @param x the first {@code char} to compare 7115 * @param y the second {@code char} to compare 7116 * @return the value {@code 0} if {@code x == y}; 7117 * a value less than {@code 0} if {@code x < y}; and 7118 * a value greater than {@code 0} if {@code x > y} 7119 * @since 1.7 7120 */ 7121 public static int compare(char x, char y) { 7122 return x - y; 7123 } 7124 7125 /** 7126 * Converts the character (Unicode code point) argument to uppercase using 7127 * information from the UnicodeData file. 7128 * 7129 * @param codePoint the character (Unicode code point) to be converted. 7130 * @return either the uppercase equivalent of the character, if 7131 * any, or an error flag ({@code Character.ERROR}) 7132 * that indicates that a 1:M {@code char} mapping exists. 7133 * @see Character#isLowerCase(char) 7134 * @see Character#isUpperCase(char) 7135 * @see Character#toLowerCase(char) 7136 * @see Character#toTitleCase(char) 7137 * @since 1.4 7138 */ 7139 static int toUpperCaseEx(int codePoint) { 7140 assert isValidCodePoint(codePoint); 7141 return CharacterData.of(codePoint).toUpperCaseEx(codePoint); 7142 } 7143 7144 /** 7145 * Converts the character (Unicode code point) argument to uppercase using case 7146 * mapping information from the SpecialCasing file in the Unicode 7147 * specification. If a character has no explicit uppercase 7148 * mapping, then the {@code char} itself is returned in the 7149 * {@code char[]}. 7150 * 7151 * @param codePoint the character (Unicode code point) to be converted. 7152 * @return a {@code char[]} with the uppercased character. 7153 * @since 1.4 7154 */ 7155 static char[] toUpperCaseCharArray(int codePoint) { 7156 // As of Unicode 6.0, 1:M uppercasings only happen in the BMP. 7157 assert isBmpCodePoint(codePoint); 7158 return CharacterData.of(codePoint).toUpperCaseCharArray(codePoint); 7159 } 7160 7161 /** 7162 * The number of bits used to represent a <tt>char</tt> value in unsigned 7163 * binary form, constant {@code 16}. 7164 * 7165 * @since 1.5 7166 */ 7167 public static final int SIZE = 16; 7168 7169 /** 7170 * The number of bytes used to represent a {@code char} value in unsigned 7171 * binary form. 7172 * 7173 * @since 1.8 7174 */ 7175 public static final int BYTES = SIZE / Byte.SIZE; 7176 7177 /** 7178 * Returns the value obtained by reversing the order of the bytes in the 7179 * specified <tt>char</tt> value. 7180 * 7181 * @param ch The {@code char} of which to reverse the byte order. 7182 * @return the value obtained by reversing (or, equivalently, swapping) 7183 * the bytes in the specified <tt>char</tt> value. 7184 * @since 1.5 7185 */ 7186 public static char reverseBytes(char ch) { 7187 return (char) (((ch & 0xFF00) >> 8) | (ch << 8)); 7188 } 7189 7190 /** 7191 * Returns the Unicode name of the specified character 7192 * {@code codePoint}, or null if the code point is 7193 * {@link #UNASSIGNED unassigned}. 7194 * <p> 7195 * Note: if the specified character is not assigned a name by 7196 * the <i>UnicodeData</i> file (part of the Unicode Character 7197 * Database maintained by the Unicode Consortium), the returned 7198 * name is the same as the result of expression. 7199 * 7200 * <blockquote>{@code 7201 * Character.UnicodeBlock.of(codePoint).toString().replace('_', ' ') 7202 * + " " 7203 * + Integer.toHexString(codePoint).toUpperCase(Locale.ENGLISH); 7204 * 7205 * }</blockquote> 7206 * 7207 * @param codePoint the character (Unicode code point) 7208 * 7209 * @return the Unicode name of the specified character, or null if 7210 * the code point is unassigned. 7211 * 7212 * @exception IllegalArgumentException if the specified 7213 * {@code codePoint} is not a valid Unicode 7214 * code point. 7215 * 7216 * @since 1.7 7217 */ 7218 public static String getName(int codePoint) { 7219 if (!isValidCodePoint(codePoint)) { 7220 throw new IllegalArgumentException(); 7221 } 7222 String name = CharacterName.get(codePoint); 7223 if (name != null) 7224 return name; 7225 if (getType(codePoint) == UNASSIGNED) 7226 return null; 7227 UnicodeBlock block = UnicodeBlock.of(codePoint); 7228 if (block != null) 7229 return block.toString().replace('_', ' ') + " " 7230 + Integer.toHexString(codePoint).toUpperCase(Locale.ENGLISH); 7231 // should never come here 7232 return Integer.toHexString(codePoint).toUpperCase(Locale.ENGLISH); 7233 } 7234 }