public final class UnquotedSplit
extends java.lang.Object
implements java.lang.Iterable<java.lang.CharSequence>
Iterable that iterates the elements of a CharSequence of a comma (or other character) separated value
list.
Example:
Iterator<CharSequence> i = new Split("a, b,def,123", ',').iterator();
i.next(); // returns "a"
i.next(); // returns " b"
i.next(); // returns "def"
i.next(); // returns "123"
i.hasNext(); // false
Separators between quote characters (") will be ignored.
Example:
Iterator<CharSequence> i = new Split("\"a, b\",\"def,123\"", ',').iterator();
i.next(); // returns "a, b"
i.next(); // returns "def,123"
i.hasNext(); // false
Iterating an empty CharSequence or a CharSequence without (unquoted) separators will return exactly one element.
Example:
Iterator<CharSequence> i = new Split("", ',').iterator();
i.next(); // returns ""
i.hasNext(); // false
Iterator<CharSequence> i2 = new Split("\"abc,def\"", ',').iterator();
i2.next(); // returns "abc,def"
i2.hasNext(); // false
| Constructor and Description |
|---|
UnquotedSplit(java.lang.CharSequence value,
char separator)
Creates an
Iterable that returns Iterators for all elements of the given CharSequence which are
separated by the given separator, unless it's quoted in ". |
UnquotedSplit(java.lang.CharSequence value,
char separator,
char quotingChar)
Creates an
Iterable that returns Iterators for all elements of the given CharSequence which are
separated by the given separator, unless it's quoted in a pair of the given quote character. |
| Modifier and Type | Method and Description |
|---|---|
java.util.Iterator<java.lang.CharSequence> |
iterator() |
public UnquotedSplit(java.lang.CharSequence value,
char separator)
Iterable that returns Iterators for all elements of the given CharSequence which are
separated by the given separator, unless it's quoted in ".value - The CharSequence that contains a list of values.separator - The separator that separates the values.public UnquotedSplit(java.lang.CharSequence value,
char separator,
char quotingChar)
Iterable that returns Iterators for all elements of the given CharSequence which are
separated by the given separator, unless it's quoted in a pair of the given quote character.value - The CharSequence that contains a list of values.separator - The separator that separates the values.