org.merlotxml.util
Class StringUtil

java.lang.Object
  extended byorg.merlotxml.util.StringUtil

public class StringUtil
extends java.lang.Object

String utilities

Author:
Tim McCune

Nested Class Summary
static interface StringUtil.KeyFinder
           
 
Field Summary
static int RECURSION_THRESHOLD
           
 
Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String lookupKeysInString(java.lang.String str, int recurselvl, StringUtil.KeyFinder finder)
           
static java.lang.String lookupKeysInString(java.lang.String str, StringUtil.KeyFinder finder)
          This looks up {% %} delimted keys in a string and replaces them.
static boolean match(java.lang.String pattern, java.lang.String input)
          Match a file glob style expression without ranges.
static java.lang.String sReplace(java.lang.String search, java.lang.String replace, java.lang.String source)
          Search a string for all instances of a substring and replace it with another string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECURSION_THRESHOLD

public static final int RECURSION_THRESHOLD
See Also:
Constant Field Values
Constructor Detail

StringUtil

public StringUtil()
Method Detail

sReplace

public static java.lang.String sReplace(java.lang.String search,
                                        java.lang.String replace,
                                        java.lang.String source)
Search a string for all instances of a substring and replace it with another string. Amazing that this is not a method of java.lang.String since I use it all the time.

Parameters:
search - Substring to search for
replace - String to replace it with
source - String to search through
Returns:
The source with all instances of search replaced by replace

match

public static boolean match(java.lang.String pattern,
                            java.lang.String input)
Match a file glob style expression without ranges. '*' matches zero or more chars. '?' matches any single char.

Parameters:
pattern - A glob-style pattern to match
input - The string to match
Returns:
whether or not the string matches the pattern.

lookupKeysInString

public static java.lang.String lookupKeysInString(java.lang.String str,
                                                  StringUtil.KeyFinder finder)
This looks up {% %} delimted keys in a string and replaces them. This is used by resource catalog, TreeConfig, and several other components.


lookupKeysInString

public static java.lang.String lookupKeysInString(java.lang.String str,
                                                  int recurselvl,
                                                  StringUtil.KeyFinder finder)