org.sadun.util
Class QuoteAwareStringTokenizer
java.lang.Object
org.sadun.util.QuoteAwareStringTokenizer
- All Implemented Interfaces:
- java.util.Enumeration
- public class QuoteAwareStringTokenizer
- extends java.lang.Object
- implements java.util.Enumeration
A StringTokenizer-compatible class which takes quotes into account.
The tokenizer behaves like StringTokenizer, except that it accepts a set of quote pairs indicating opening and closing quote character
(denoted, at construction, by a String containing the pairs consecutively: ()[] for example) and returns quoted portions
of the string as single tokens.
- Author:
- Cristiano Sadun
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QuoteAwareStringTokenizer
public QuoteAwareStringTokenizer(java.lang.String str,
java.lang.String delim,
java.lang.String quotePairs,
boolean returnDelims)
QuoteAwareStringTokenizer
public QuoteAwareStringTokenizer(java.lang.String str,
java.lang.String delim,
java.lang.String quotePairs)
QuoteAwareStringTokenizer
public QuoteAwareStringTokenizer(java.lang.String str,
java.lang.String delim,
boolean returnDelims)
QuoteAwareStringTokenizer
public QuoteAwareStringTokenizer(java.lang.String str,
java.lang.String delim)
QuoteAwareStringTokenizer
public QuoteAwareStringTokenizer(java.lang.String str)
countTokens
public int countTokens()
- Returns:
nextToken
public java.lang.String nextToken()
- Returns:
nextElement
public java.lang.Object nextElement()
- Specified by:
nextElement
in interface java.util.Enumeration
hasMoreElements
public boolean hasMoreElements()
- Specified by:
hasMoreElements
in interface java.util.Enumeration
hasMoreTokens
public boolean hasMoreTokens()
- Returns:
nextToken
public java.lang.String nextToken(java.lang.String delim,
java.lang.String quotePairs)
nextToken
public java.lang.String nextToken(java.lang.String delim)