guardedSplit
public static java.lang.String[] guardedSplit(java.lang.String str,
java.lang.String delim,
char protect)
splits the string, guarding the space within protect. For example, if you have a
comma-separable line with quoted fields, then this can be used so that a quoted field
is not split on a comma:
s= """2009,0,2,"Hot riser,spark",99"""
could be split into five fields with guardedSplit(s,',','"').
- Parameters:
str - the string to split.
delim - the delimiter we split on. (similar to s.split(delim,-2))
protect - character that blocks off delimiter, such as quote.
- Returns: