org.paneris.util
Class CSVStringEnumeration

java.lang.Object
  extended by org.paneris.util.CSVStringEnumeration
All Implemented Interfaces:
java.util.Enumeration

public class CSVStringEnumeration
extends java.lang.Object
implements java.util.Enumeration

A utility for tokenising a string made up of comma-separated variables. Unlike Tim's effort, it handles quoted variables as well. FIXME just don't try and read off the end if the last field is zero-length.

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

Author:
williamc@paneris.org

Constructor Summary
CSVStringEnumeration()
           
 
Method Summary
 boolean hasMoreElements()
          Are there any more tokens to come?
 java.lang.Object nextElement()
          Return the next token as an Object.
 java.lang.String nextToken()
          Return the next token as a String.
 void reset(java.lang.String line)
          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(java.lang.String line)
Look at a new string.


hasMoreElements

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

Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

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

Specified by:
nextElement in interface java.util.Enumeration

nextToken

public java.lang.String nextToken()
Return the next token as a String.



Copyright © 2000-2008 PanEris. All Rights Reserved.