Java String Match regionMatches(CharSequence receiver, int thisOffset, String other, int otherOffset, int length, boolean ignoreCase)

Here you can find the source of regionMatches(CharSequence receiver, int thisOffset, String other, int otherOffset, int length, boolean ignoreCase)

Description

region Matches

License

Open Source License

Declaration

public static boolean regionMatches(CharSequence receiver, int thisOffset, String other, int otherOffset,
            int length, boolean ignoreCase) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static boolean regionMatches(CharSequence receiver, int thisOffset, String other, int otherOffset,
            int length, boolean ignoreCase) {
        if (ignoreCase) {
            for (int i = 0; i < length; i++) {
                if (Character.toLowerCase(receiver.charAt(i + thisOffset)) != Character
                        .toLowerCase(other.charAt(i + otherOffset)))
                    return false;
            }//from  w  w  w.ja v  a  2  s  .c o  m
        } else {
            for (int i = 0; i < length; i++) {
                if (receiver.charAt(i + thisOffset) != other.charAt(i + otherOffset))
                    return false;
            }
        }
        return true;
    }
}

Related

  1. regionMatches(byte[] subValue, byte[] superValue, int offset)
  2. regionMatches(char[] source, char[] target, int sIndex)
  3. regionMatches(CharSequence a, int i, CharSequence b, int j, int len)
  4. regionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring, int start, int length)
  5. regionMatches(CharSequence cs, boolean ignoreCase, int thisStart, CharSequence substring, int start, int length)
  6. regionMatches(CharSequence seq, int toff, CharSequence other, int ooff, int len)
  7. regionMatches(final char[] content, final int index, final String tag)
  8. regionMatches(final CharSequence cs, final boolean ignoreCase, final int thisStart, final CharSequence substring, final int start, final int length)
  9. regionMatches(final CharSequence seq1, final int start1, final CharSequence seq2, final int start2, final int len, final boolean ignoreCase)