Returns the upper case equivalent for the specified character if the character is a lower case letter. Otherwise, the specified character is returned unchanged. @param c the character to convert. @return if c is a lower case character then its upper case counterpart, othe
(char c)
| 3650 | * counterpart, otherwise just {@code c}. |
| 3651 | */ |
| 3652 | public static char toUpperCase(char c) { |
| 3653 | // Optimized case for ASCII |
| 3654 | if ('a' <= c && c <= 'z') { |
| 3655 | return (char) (c - ('a' - 'A')); |
| 3656 | } |
| 3657 | if (c < 181) { |
| 3658 | return c; |
| 3659 | } |
| 3660 | // if (c<1000) { |
| 3661 | // return (char)uppercaseValuesCache[(int)c-181]; |
| 3662 | // } |
| 3663 | // int result = BinarySearch.binarySearchRange(uppercaseKeys, c); |
| 3664 | // if (result >= 0) { |
| 3665 | // boolean by2 = false; |
| 3666 | // char start = uppercaseKeys.charAt(result); |
| 3667 | // char end = uppercaseValues[result * 2]; |
| 3668 | // if ((start & 0x8000) != (end & 0x8000)) { |
| 3669 | // end ^= 0x8000; |
| 3670 | // by2 = true; |
| 3671 | // } |
| 3672 | // if (c <= end) { |
| 3673 | // if (by2 && (c & 1) != (start & 1)) { |
| 3674 | // return c; |
| 3675 | // } |
| 3676 | // char mapping = uppercaseValues[result * 2 + 1]; |
| 3677 | // return (char) (c + mapping); |
| 3678 | // } |
| 3679 | // } |
| 3680 | return c; |
| 3681 | } |
| 3682 | |
| 3683 | /** |
| 3684 | * Returns the upper case equivalent for the specified code point if the |
no outgoing calls
no test coverage detected