Java String Match regionMatches(CharSequence a, int i, CharSequence b, int j, int len)

Here you can find the source of regionMatches(CharSequence a, int i, CharSequence b, int j, int len)

Description

region Matches

License

Apache License

Declaration

public static boolean regionMatches(CharSequence a, int i, CharSequence b, int j, int len) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static boolean regionMatches(CharSequence a, int i, CharSequence b, int j, int len) {
        if (i + len > a.length() || j + len > b.length() || i < 0 || j < 0 || len < 0) {
            return false;
        }/*from   w  w w  . j  ava  2  s .  co  m*/
        while (len-- > 0) {
            if (a.charAt(i++) != b.charAt(j++)) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. regionMatches(boolean ignoreCase, CharSequence thisSeq, int toffset, CharSequence otherSeq, int ooffset, int len)
  2. regionMatches(byte[] ba1, int pos1, byte[] ba2, int pos2, int len)
  3. regionMatches(byte[] subValue, byte[] superValue, int offset)
  4. regionMatches(char[] source, char[] target, int sIndex)
  5. regionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring, int start, int length)
  6. regionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring, int start, int length)
  7. regionMatches(CharSequence receiver, int thisOffset, String other, int otherOffset, int length, boolean ignoreCase)
  8. regionMatches(CharSequence seq, int toff, CharSequence other, int ooff, int len)