gt: 		if (oldPattern == null || newPattern == null) {
context: package org.g4studio.core.resource.util;
  
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.List;
  import java.util.Locale;
  import java.util.Set;
  import java.util.StringTokenizer;
  import java.util.TreeSet;
  
  /**
   * StringUtils
   * 
   * @author HuangYunHui|XiongChun
   * @since 2009-11-09
   */
  public abstract class StringUtils {
  
  	private static final String FOLDER_SEPARATOR = "/";
  
  	private static final String WINDOWS_FOLDER_SEPARATOR = "\\";
  
  	private static final String TOP_PATH = "..";
  
  	private static final String CURRENT_PATH = ".";
  
  	private static final char EXTENSION_SEPARATOR = '.';
  
  	// ---------------------------------------------------------------------
  	// General convenience methods for working with Strings
  	// ---------------------------------------------------------------------
  
  	/**
  	 * Check if a String has length.
  	 * <p>
  	 * 
  	 * <pre>
  	 * StringUtils.hasLength(null) = false
  	 * StringUtils.hasLength("") = false
  	 * StringUtils.hasLength(" ") = true
  	 * StringUtils.hasLength("Hello") = true
  	 * </pre>
  	 * 
  	 * @param str
  	 *            the String to check, may be <code>null</code>
  	 * @return <code>true</code> if the String is not null and has length
  	 */
  	public static boolean hasLength(String str) {
  		return (str != null && str.length() > 0);
  	}
  
  	/**
  	 * Check if a String has text. More specifically, returns <code>true</code>
  	 * if the string not <code>null<code>, it's <code>length is > 0</code>, and it has at least one
  	 * non-whitespace character.
  	 * <p>
  	 * 
  	 * <pre>
  	 * StringUtils.hasText(null) = false
  	 * StringUtils.hasText("") = false
  	 * StringUtils.hasText(" ") = false
  	 * StringUtils.hasText("12345") = true
  	 * StringUtils.hasText(" 12345 ") = true
  	 * </pre>
  	 * 
  	 * @param str
  	 *            the String to check, may be <code>null</code>
  	 * @return <code>true</code> if the String is not null, length > 0, and not
  	 *         whitespace only
  	 * @see java.lang.Character#isWhitespace
  	 */
  	public static boolean hasText(String str) {
  		int strLen;
  		if (str == null || (strLen = str.length()) == 0) {
  			return false;
  		}
  		for (int i = 0; i < strLen; i++) {
  			if (!Character.isWhitespace(str.charAt(i))) {
  				return true;
  			}
  		}
  		return false;
  	}
  
  	/**
  	 * Trim leading and trailing whitespace from the given String.
  	 * 
  	 * @param str
  	 *            the String to check
  	 * @return the trimmed String
  	 * @see java.lang.Character#isWhitespace
  	 */
  	public static String trimWhitespace(String str) {
  		if (!hasLength(str)) {
  			return str;
  		}
  		StringBuffer buf = new StringBuffer(str);
  		while (buf.length() > 0 && Character.isWhitespace(buf.charAt(0))) {
  			buf.deleteCharAt(0);
  		}
  		while (buf.length() > 0 && Character.isWhitespace(buf.charAt(buf.length() - 1))) {
  			buf.deleteCharAt(buf.length() - 1);
  		}
  		return buf.toString();
  	}
  
  	/**
  	 * Trim leading whitespace from the given String.
  	 * 
  	 * @param str
  	 *            the String to check
  	 * @return the trimmed String
  	 * @see java.lang.Character#isWhitespace
  	 */
  	public static String trimLeadingWhitespace(String str) {
  		if (!hasLength(str)) {
  			return str;
  		}
  		StringBuffer buf = new StringBuffer(str);
  		while (buf.length() > 0 && Character.isWhitespace(buf.charAt(0))) {
  			buf.deleteCharAt(0);
  		}
  		return buf.toString();
  	}
  
  	/**
  	 * Trim trailing whitespace from the given String.
  	 * 
  	 * @param str
  	 *            the String to check
  	 * @return the trimmed String
  	 * @see java.lang.Character#isWhitespace
  	 */
  	public static String trimTrailingWhitespace(String str) {
  		if (!hasLength(str)) {
  			return str;
  		}
  		StringBuffer buf = new StringBuffer(str);
  		while (buf.length() > 0 && Character.isWhitespace(buf.charAt(buf.length() - 1))) {
  			buf.deleteCharAt(buf.length() - 1);
  		}
  		return buf.toString();
  	}
  
  	/**
  	 * Trim <i>all</i> whitespace from the given String: leading, trailing, and
  	 * inbetween characters.
  	 * 
  	 * @param str
  	 *            the String to check
  	 * @return the trimmed String
  	 * @see java.lang.Character#isWhitespace
  	 */
  	public static String trimAllWhitespace(String str) {
  		if (!hasLength(str)) {
  			return str;
  		}
  		StringBuffer buf = new StringBuffer(str);
  		int index = 0;
  		while (buf.length() > index) {
  			if (Character.isWhitespace(buf.charAt(index))) {
  				buf.deleteCharAt(index);
  			} else {
  				index++;
  			}
  		}
  		return buf.toString();
  	}
  
  	/**
  	 * Test if the given String starts with the specified prefix, ignoring
  	 * upper/lower case.
  	 * 
  	 * @param str
  	 *            the String to check
  	 * @param prefix
  	 *            the prefix to look for
  	 * @see java.lang.String#startsWith
  	 */
  	public static boolean startsWithIgnoreCase(String str, String prefix) {
  		if (str == null || prefix == null) {
  			return false;
  		}
  		if (str.startsWith(prefix)) {
  			return true;
  		}
  		if (str.length() < prefix.length()) {
  			return false;
  		}
  		String lcStr = str.substring(0, prefix.length()).toLowerCase();
  		String lcPrefix = prefix.toLowerCase();
  		return lcStr.equals(lcPrefix);
  	}
  
  	/**
  	 * Test if the given String ends with the specified suffix, ignoring
  	 * upper/lower case.
  	 * 
  	 * @param str
  	 *            the String to check
  	 * @param suffix
  	 *            the suffix to look for
  	 * @see java.lang.String#endsWith
  	 */
  	public static boolean endsWithIgnoreCase(String str, String suffix) {
  		if (str == null || suffix == null) {
  			return false;
  		}
  		if (str.endsWith(suffix)) {
  			return true;
  		}
  		if (str.length() < suffix.length()) {
  			return false;
  		}
  
  		String lcStr = str.substring(str.length() - suffix.length()).toLowerCase();
  		String lcSuffix = suffix.toLowerCase();
  		return lcStr.equals(lcSuffix);
  	}
  
  	/**
  	 * Count the occurrences of the substring in string s.
  	 * 
  	 * @param str
  	 *            string to search in. Return 0 if this is null.
  	 * @param sub
  	 *            string to search for. Return 0 if this is null.
  	 */
  	public static int countOccurrencesOf(String str, String sub) {
  		if (str == null || sub == null || str.length() == 0 || sub.length() == 0) {
  			return 0;
  		}
  		int count = 0, pos = 0, idx = 0;
  		while ((idx = str.indexOf(sub, pos)) != -1) {
  			++count;
  			pos = idx + sub.length();
  		}
  		return count;
  	}
  
  	/**
  	 * Replace all occurences of a substring within a string with another
  	 * string.
  	 * 
  	 * @param inString
  	 *            String to examine
  	 * @param oldPattern
  	 *            String to replace
  	 * @param newPattern
  	 *            String to insert
  	 * @return a String with the replacements
  	 */
  	public static String replace(String inString, String oldPattern, String newPattern) {
  		if (inString == null) {
  			return null;
  		}
  