package net.darkmist.alib.str;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class StrUtil
{
	private static final Class<StrUtil> CLASS = StrUtil.class;
        private static final Log logger = LogFactory.getLog(CLASS);

	private StrUtil()
	{
	}

	/**
	 * Join strings with a delimiter.
	 * @param delimiter The delimiter to use between strings.
	 * @param strs The Strings to join.
	 */
	// not deprecated because this allows vargs
	public static final String join(CharSequence delimiter, CharSequence... strs)
	{
		return StringUtils.join(strs, delimiter.toString());
	}
}

@@ -25,16 +25,68 @@
 b.str;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 import o
@@ -121,16 +121,16 @@
 gUtils;%0A
-
 import o
@@ -357,16 +357,83 @@
 (CLASS);
+%0A%09private static final String%5B%5D EMPTY_STRING_ARRAY = new String%5B0%5D;
 %0A%0A%09priva
@@ -720,16 +720,16 @@
 trs)%0A%09%7B%0A
-
 %09%09return
@@ -777,11 +777,643 @@
 g());%0A%09%7D
+%0A%0A%09/**%0A%09 * Split a string on a delimiter.%0A%09 * @param str The string to split.%0A%09 * @param delim The delimiter to split on.%0A%09 * @return The substrings of str that were seperated by delim.%0A%09 */%0A%09public static String%5B%5D split(String str, char delim)%0A%09%7B%0A%09%09List strs;%0A%09%09int len;%0A%09%09int start,end;%0A%09%09%0A%09%09if(str == null)%0A%09%09%09return EMPTY_STRING_ARRAY;%0A%09%09if((len = str.length())==0)%0A%09%09%09return new String%5B%5D%7B%22%22%7D;%0A%09%09strs = new ArrayList(len);%0A%09%09for(start=0;start%3Clen && (end = str.indexOf(delim, start))%3E=0;start=end+1)%0A%09%09%09strs.add(str.substring(start,end));%0A%09%09strs.add(str.substring(start));%0A%09%09return (String%5B%5D)strs.toArray(EMPTY_STRING_ARRAY);%0A%09%7D
 %0A%7D%0A

add simple character split that doesn't use regexes