Example usage for org.springframework.util StringUtils substringMatch

List of usage examples for org.springframework.util StringUtils substringMatch

Introduction

In this page you can find the example usage for org.springframework.util StringUtils substringMatch.

Prototype

public static boolean substringMatch(CharSequence str, int index, CharSequence substring) 

Source Link

Document

Test whether the given string matches the given substring at the given index.

Usage

From source file:com.surveypanel.utils.PlaceHolderParser.java

private static int findPlaceholderEndIndex(CharSequence buf, int startIndex) {
    int index = startIndex + DEFAULT_PLACEHOLDER_PREFIX.length();
    int withinNestedPlaceholder = 0;
    while (index < buf.length()) {
        if (StringUtils.substringMatch(buf, index, DEFAULT_PLACEHOLDER_SUFFIX)) {
            if (withinNestedPlaceholder > 0) {
                withinNestedPlaceholder--;
                index = index + DEFAULT_PLACEHOLDER_SUFFIX.length();
            } else {
                return index;
            }//from  w  ww .  java  2 s .  com
        } else if (StringUtils.substringMatch(buf, index, DEFAULT_PLACEHOLDER_PREFIX)) {
            withinNestedPlaceholder++;
            index = index + DEFAULT_PLACEHOLDER_PREFIX.length();
        } else {
            index++;
        }
    }
    return -1;
}

From source file:com.harrywu.springweb.common.PropertyPlaceholderHelper.java

private int findPlaceholderEndIndex(CharSequence buf, int startIndex) {
    int index = startIndex + this.placeholderPrefix.length();
    int withinNestedPlaceholder = 0;
    while (index < buf.length()) {
        if (StringUtils.substringMatch(buf, index, this.placeholderSuffix)) {
            if (withinNestedPlaceholder > 0) {
                withinNestedPlaceholder--;
                index = index + this.placeholderPrefix.length() - 1;
            } else {
                return index;
            }/*from  ww  w .  j av a  2s . c  o  m*/
        } else if (StringUtils.substringMatch(buf, index, this.placeholderPrefix)) {
            withinNestedPlaceholder++;
            index = index + this.placeholderPrefix.length();
        } else {
            index++;
        }
    }
    return -1;
}

From source file:costumetrade.common.util.PropertyPlaceholderHelper.java

private int findPlaceholderEndIndex(CharSequence buf, int startIndex) {
    int index = startIndex + this.placeholderPrefix.length();
    int withinNestedPlaceholder = 0;
    while (index < buf.length()) {
        if (StringUtils.substringMatch(buf, index, this.placeholderSuffix)) {
            if (withinNestedPlaceholder > 0) {
                withinNestedPlaceholder--;
                index = index + this.placeholderSuffix.length();
            } else {
                return index;
            }/* www .ja  v  a2 s  . c  o  m*/
        } else if (StringUtils.substringMatch(buf, index, this.simplePrefix)) {
            withinNestedPlaceholder++;
            index = index + this.simplePrefix.length();
        } else {
            index++;
        }
    }
    return -1;
}