Java String Match regionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring, int start, int length)

Here you can find the source of regionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring, int start, int length)

Description

Green implementation of regionMatches.

License

Open Source License

Parameter

Parameter Description
cs the CharSequence to be processed
ignoreCase whether or not to be case insensitive
thisStart the index to start on the cs CharSequence
substring the CharSequence to be looked for
start the index to start on the substring CharSequence
length character length of the region

Return

whether the region matched

Declaration

static boolean regionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring,
        int start, int length) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from w ww . ja v a2 s.com
     * Green implementation of regionMatches.
     *
     * @param cs the {@code CharSequence} to be processed
     * @param ignoreCase whether or not to be case insensitive
     * @param thisStart the index to start on the {@code cs} CharSequence
     * @param substring the {@code CharSequence} to be looked for
     * @param start the index to start on the {@code substring} CharSequence
     * @param length character length of the region
     * @return whether the region matched
     */
    static boolean regionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring,
            int start, int length) {
        if (cs instanceof String && substring instanceof String) {
            return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
        } else {
            // TODO: Implement rather than convert to String
            return cs.toString().regionMatches(ignoreCase, thisStart, substring.toString(), start, length);
        }
    }
}

Related

  1. regionMatches(byte[] ba1, int pos1, byte[] ba2, int pos2, int len)
  2. regionMatches(byte[] subValue, byte[] superValue, int offset)
  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 receiver, int thisOffset, String other, int otherOffset, int length, boolean ignoreCase)
  7. regionMatches(CharSequence seq, int toff, CharSequence other, int ooff, int len)
  8. regionMatches(final char[] content, final int index, final String tag)
  9. regionMatches(final CharSequence cs, final boolean ignoreCase, final int thisStart, final CharSequence substring, final int start, final int length)