Compares the message bytes to the specified String object. @param s the String to compare @return true if the comparison succeeded, false otherwise
(String s)
| 499 | * @return <code>true</code> if the comparison succeeded, <code>false</code> otherwise |
| 500 | */ |
| 501 | public boolean equalsIgnoreCase(String s) { |
| 502 | char[] c = buff; |
| 503 | int len = end - start; |
| 504 | if (c == null || len != s.length()) { |
| 505 | return false; |
| 506 | } |
| 507 | int off = start; |
| 508 | for (int i = 0; i < len; i++) { |
| 509 | char c1 = c[off++]; |
| 510 | char c2 = s.charAt(i); |
| 511 | // Use ASCII short-cut if possible |
| 512 | if (c1 > 0xFF || c2 > 0xFF) { |
| 513 | if (Character.toLowerCase(c1) != Character.toLowerCase(c2)) { |
| 514 | return false; |
| 515 | } |
| 516 | } else if (Ascii.toLower(c1) != Ascii.toLower(c2)) { |
| 517 | return false; |
| 518 | } |
| 519 | } |
| 520 | return true; |
| 521 | } |
| 522 | |
| 523 | |
| 524 | /** |