public boolean regionMatches(boolean ignoreCase,int thisStart,String string,int start,int length){
  if (!ignoreCase) {
    return regionMatches(thisStart,string,start,length);
  }
  if (string == null) {
    throw new NullPointerException("string == null");
  }
  if (thisStart < 0 || length > count - thisStart) {
    return false;
  }
  if (start < 0 || length > string.count - start) {
    return false;
  }
  thisStart+=offset;
  start+=string.offset;
  int end=thisStart + length;
  char[] target=string.value;
  while (thisStart < end) {
    char c1=value[thisStart++];
    char c2=target[start++];
    if (c1 != c2 && foldCase(c1) != foldCase(c2)) {
      return false;
    }
  }
  return true;
}

public boolean regionMatches ( boolean ignoreCase , int thisStart , String string , int start , int length ) { if ( ! ignoreCase ) { return regionMatches ( thisStart , string , start , length ) ; } if ( string == null ) { throw new NullPointerException ( "string == null" ) ; } if ( thisStart < 0 || length > count - thisStart ) { return false ; } if ( start < 0 || length > string . count - start ) { return false ; } thisStart += offset ; start += string . offset ; int end = thisStart + length ; char [ ] target = string . value ; while ( thisStart < end ) { char c1 = value [ thisStart ++ ] ; char c2 = target [ start ++ ] ; if ( c1 != c2 && foldCase ( c1 ) != foldCase ( c2 ) ) { return false ; } } return true ; }
tests if two string regions are equal . a substring of this string object is compared to a substring of the argument other . the result is true if these substrings represent character sequences that are the same , ignoring case if and only if ignorecase is true . the substring of this string object to be compared begins at index toffset and has length len . the substring of other to be compared begins at index ooffset and has length len . the result is false if and only if at least one of the following is true : toffset is negative . ooffset is negative . toffset + len is greater than the length of this string object . ooffset + len is greater than the length of the other argument . there is some nonnegative integer k less than len such that : this . charat ( toffset + k ) ! = other . charat ( ooffset + k ) ignorecase is true and there is some nonnegative integer less than len such that : character . tolowercase ( this . charat ( toffset + k ) ) ! = character . tolowercase ( other . charat ( ooffset + k ) ) and : character . touppercase ( this . charat ( toffset + k ) ) ! = character . touppercase ( other . charat ( ooffset + k ) )
