import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtils
cp = pos + seplen;
wasescaped = escape == -1;
// last separator may be in an unmatched quote
+ // private static final Pattern DELIMITERS_PATTERN =
+ // Pattern.compile(".*='[^']*(?!')");
wasquoted = DELIMITERS_PATTERN.matcher(lstitem).matches();
}
if (cp < input.length())
public static int indexOfFirstWhitespace(String text)
{
- int index = -1;
- Pattern pat = Pattern.compile("\\s");
- Matcher m = pat.matcher(text);
- if (m.find())
+ // Rewritten to not use regex for Jalviewjs. Probably more efficient this
+ // way anyway.
+ if (text == null)
+ {
+ return -1;
+ }
+ for (int i = 0; i < text.length(); i++)
{
- index = m.start();
+ if (Character.isWhitespace(text.charAt(i)))
+ {
+ return i;
+ }
}
- return index;
+ return -1;
}
/*