Split, to be removed in version 2.0.@Deprecated
public final class CsvIterable
extends java.lang.Object
implements java.lang.Iterable<java.lang.String>
Iterable that iterates the elements of a String of a comma (or other character) separated value list.
Example:
Iterator<String> i = new CsvIterable<String>("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<String> i = new CsvIterable<String>("\"a, b\",\"def,123\"", ',').iterator();
i.next(); // returns "a, b"
i.next(); // returns "def,123"
i.hasNext(); // false
Iterating an empty String or a string without (unquoted) separators will return exactly one element.
Example:
Iterator<String> i = new CsvIterable<String>("", ',').iterator();
i.next(); // returns ""
i.hasNext(); // false
Iterator<String> i2 = new CsvIterable<String>("\"abc,def\"", ',').iterator();
i2.next(); // returns "abc,def"
i2.hasNext(); // false
| Constructor and Description |
|---|
CsvIterable(java.lang.String value,
char separator)
Deprecated.
Creates an
Iterable that returns Iterators for all elements of the given string which are
separated by the given separator. |
| Modifier and Type | Method and Description |
|---|---|
java.util.Iterator<java.lang.String> |
iterator()
Deprecated.
|
public CsvIterable(java.lang.String value,
char separator)
Iterable that returns Iterators for all elements of the given string which are
separated by the given separator.value - The string that contains a list of values.separator - The separator that separates the values.