code: private static int matchString(String str, CharSequence src, int begin, int end) {
      final int patternLength = str.length();
      int i = 0;
      for (; (i < patternLength) && ((begin + i) < end); i++) {
        final char exp = str.charAt(i);
        final char enc = src.charAt(begin + i);
        if (exp != enc) return Pattern.MISMATCH;
      }
      return i;
    }
docs: Matches (part of) a character sequence against a pattern string.
  
  @param  str   the pattern string.
  @param  src   the input sequence. Must not be null.
  @param  begin start of index to scan characters from <code>src</code>.
  @param  end   end of index to scan characters from <code>src</code>.
  
  @return the number of characters matched, or {@link Pattern#MISMATCH} if an unexpected character is encountered.