All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.jinjava.util.CharArrayUtils Maven / Gradle / Ivy

There is a newer version: 2.7.3
Show newest version
package com.hubspot.jinjava.util;

public class CharArrayUtils {

  public static boolean charArrayRegionMatches(char[] value, int startPos, CharSequence toMatch) {
    int matchLen = toMatch.length(),
        endPos = startPos + matchLen;

    if (endPos > value.length) {
      return false;
    }

    for (int matchIndex = 0, i = startPos; i < endPos; i++, matchIndex++) {
      if (value[i] != toMatch.charAt(matchIndex)) {
        return false;
      }
    }

    return true;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy