Handle the special case of splitting up an empty source string, which

should return an empty array rather than an array containing an empty 
string.



git-svn-id: https://samskivert.googlecode.com/svn/trunk@1778 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
andrzej
2006-02-01 23:18:18 +00:00
parent 7d7c32b6e2
commit 9c81cbfaae
@@ -1186,6 +1186,11 @@ public class StringUtil
*/
public static String[] split (String source, String sep)
{
// handle the special case of a zero-component source
if (source.matches("\\s*")) {
return new String[0];
}
int tcount = 0, tpos = -1, tstart = 0;
// count up the number of tokens