org.melati.util
Class CSVStringEnumeration

Package class diagram package CSVStringEnumeration
java.lang.Object
  extended by org.melati.util.CSVStringEnumeration
All Implemented Interfaces:
Enumeration<String>

public class CSVStringEnumeration
extends Object
implements Enumeration<String>

A utility for tokenising a string made up of comma-separated variables. Unlike Tim's effort, it handles quoted variables as well.

   foo, bar om,,"baz, ,oof",xyz,   ->
     "foo", " bar om", "", "baz, , oof", "xyz", ""
 

Author:
williamc AT paneris.org

Constructor Summary
CSVStringEnumeration()
           
 
Method Summary
 boolean hasMoreElements()
          Are there any more tokens to come?
 String nextElement()
          Return the next token as an Object.
 String nextToken()
           
 void reset(String lineP)
          Look at a new string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVStringEnumeration

public CSVStringEnumeration()
Method Detail

reset

public void reset(String lineP)
Look at a new string.


hasMoreElements

public boolean hasMoreElements()
Are there any more tokens to come?

Specified by:
hasMoreElements in interface Enumeration<String>
See Also:
Enumeration.hasMoreElements()

nextElement

public final String nextElement()
Return the next token as an Object.

Specified by:
nextElement in interface Enumeration<String>
See Also:
Enumeration.nextElement()

nextToken

public String nextToken()
Returns:
the next token as a String.


Copyright © 2000-2010 PanEris. All Rights Reserved.