Java String Match regionMatches(byte[] subValue, byte[] superValue, int offset)

Here you can find the source of regionMatches(byte[] subValue, byte[] superValue, int offset)

Description

Checks whether subValue matches the region in superValue starting at offset offset.

License

BSD License

Declaration

public static boolean regionMatches(byte[] subValue, byte[] superValue, int offset) 

Method Source Code

//package com.java2s;
/*//  w w w. j  a  v  a  2 s. c o m
 * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
 *
 * Licensed under the Aduna BSD-style license.
 */

public class Main {
    /**
     * Checks whether <tt>subValue</tt> matches the region in
     * <tt>superValue</tt> starting at offset <tt>offset</tt>.
     */
    public static boolean regionMatches(byte[] subValue, byte[] superValue, int offset) {
        for (int i = 0; i < subValue.length; i++) {
            if (subValue[i] != superValue[i + offset]) {
                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(char[] source, char[] target, int sIndex)
  4. regionMatches(CharSequence a, int i, CharSequence b, int j, int len)
  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)