All Packages Class Hierarchy This Package Previous Next Index
Class jclass.util.JCCSVTokenizer
java.lang.Object
|
+----jclass.util.JCCSVTokenizer
- public class JCCSVTokenizer
- extends Object
This class parses comma-separated value strings. If a value contains
a comma, it is encased in quotes. If a value contains a quote, a quote
precedes it.
Example usage:
String token, s = "this,is,a,,test";
JCCSVTokenizer st = new JCCSVTokenizer(s);
while (st.hasMoreTokens()) {
token = st.nextToken();
println(token);
}
This prints the following to the console:
this
is
a
test
-
JCCSVTokenizer(String)
-
-
countTokens()
- This returns the next number of tokens in the string.
-
getPosition()
- This returns the current scan position within the string.
-
hasMoreTokens()
- This returns true if more tokens exist.
-
nextToken()
- This gets the next token from the string.
JCCSVTokenizer
public JCCSVTokenizer(String s)
nextToken
public String nextToken()
- This gets the next token from the string.
countTokens
public int countTokens()
- This returns the next number of tokens in the string.
hasMoreTokens
public boolean hasMoreTokens()
- This returns true if more tokens exist.
getPosition
public int getPosition()
- This returns the current scan position within the string.
All Packages Class Hierarchy This Package Previous Next Index