Compares the specified string to this string and compares the specified range of characters to determine if they are the same. @param thisStart the starting offset in this string. @param string the string to compare. @param start the starting offset in the specified
(int thisStart, String string, int start, int length)
| 584 | * if {@code string} is {@code null}. |
| 585 | */ |
| 586 | public boolean regionMatches(int thisStart, String string, int start, int length) { |
| 587 | if (string == null) { |
| 588 | throw new NullPointerException("string == null"); |
| 589 | } |
| 590 | if (start < 0 || string.count - start < length) { |
| 591 | return false; |
| 592 | } |
| 593 | if (thisStart < 0 || count - thisStart < length) { |
| 594 | return false; |
| 595 | } |
| 596 | if (length <= 0) { |
| 597 | return true; |
| 598 | } |
| 599 | int o1 = offset + thisStart, o2 = string.offset + start; |
| 600 | char[] value1 = value; |
| 601 | char[] value2 = string.value; |
| 602 | for (int i = 0; i < length; ++i) { |
| 603 | if (value1[o1 + i] != value2[o2 + i]) { |
| 604 | return false; |
| 605 | } |
| 606 | } |
| 607 | return true; |
| 608 | } |
| 609 | |
| 610 | /** |
| 611 | * Tests if two string regions are equal. |
no test coverage detected