Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

com.ibm.lpex.core
Class LpexStringTokenizer

java.lang.Object
  extended bycom.ibm.lpex.core.LpexStringTokenizer

All Implemented Interfaces:
Enumeration


public final class LpexStringTokenizer
extends Object
implements Enumeration

The string tokenizer class allows an application to break a string into tokens. The tokenization is similar to the one done by the java.util.StringTokenizer class. The main difference is that a quoted string will be returned as a single token.


Constructor Summary
LpexStringTokenizer(String str)
          Constructs a string tokenizer from the specified string.
 
Method Summary
static String addQuotes(String string)
          Convenience routine for adding quotes to a string.
 int countTokens()
          Calculates the number of times that this tokenizer's nextToken() method can be called before it generates an exception.
 boolean hasMoreElements()
          Returns the same value as the hasMoreTokens() method.
 boolean hasMoreTokens()
          Tests if there are more tokens available from this tokenizer's string.
static boolean isInvalidQuotedString(String string)
          Convenience routine for checking whether a string is not a valid quoted string.
static boolean isValidQuotedString(String string)
          Convenience routine for checking if a string is a valid quoted string.
 Object nextElement()
          Returns the same value as the nextToken() method, except that its declared return value is Object rather than String.
 String nextToken()
          Returns the next token from this string tokenizer.
 String remainingText()
          Return any text remaining in the string that is being tokenized.
static String removeQuotes(String string)
          Convenience routine for removing quotes from a string.
static String[] split(String str)
          Split the given string.
static String trimQuotes(String string)
          Convenience routine for removing the leading and trailing quotes of a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

 

 

LpexStringTokenizer

public LpexStringTokenizer(String str)

Constructs a string tokenizer from the specified string.

Method Detail

 

 

hasMoreTokens

public boolean hasMoreTokens()

Tests if there are more tokens available from this tokenizer's string.

Returns:
true if there are more tokens available from this tokenizer's string; false otherwise


 

 

nextToken

public String nextToken()

Returns the next token from this string tokenizer.

Returns:
the next token from this string tokenizer
Throws:
NoSuchElementException - if there are no more tokens in this tokenizer's string


 

 

hasMoreElements

public boolean hasMoreElements()

Returns the same value as the hasMoreTokens() method. The method is provided so that this class can implement the Enumeration interface.

Specified by:
hasMoreElements in interface Enumeration

Returns:
true if there are more tokens; false otherwise
See Also:
Enumeration, hasMoreTokens()


 

 

nextElement

public Object nextElement()

Returns the same value as the nextToken() method, except that its declared return value is Object rather than String. The method is provided so that this class can implement the Enumeration interface.

Specified by:
nextElement in interface Enumeration

Returns:
the next token in the string.
Throws:
NoSuchElementException - if there are no more tokens in this tokenizer's string
See Also:
Enumeration, nextToken()


 

 

countTokens

public int countTokens()

Calculates the number of times that this tokenizer's nextToken() method can be called before it generates an exception.

Returns:
the number of tokens remaining in the string
See Also:
nextToken()


 

 

remainingText

public String remainingText()

Return any text remaining in the string that is being tokenized.


 

 

split

public static String[] split(String str)

Split the given string.


 

 

addQuotes

public static String addQuotes(String string)

Convenience routine for adding quotes to a string. Quotes " are added to the beginning and end of the string, and any quotes and backslashes that are part of the string are prefixed with a backslash.

See Also:
removeQuotes(java.lang.String)


 

 

removeQuotes

public static String removeQuotes(String string)

Convenience routine for removing quotes from a string. If the string is null, empty, or doesn't begin with a quote ", the original string is returned. All backslashes, except those that are prefixed by another backslash, are removed as well.

Parameters:
string - assumes that isValidQuotedString(string) returned true
See Also:
addQuotes(java.lang.String), trimQuotes(java.lang.String), isValidQuotedString(java.lang.String), isInvalidQuotedString(java.lang.String)


 

 

trimQuotes

public static String trimQuotes(String string)

Convenience routine for removing the leading and trailing quotes of a string. If the string is not quoted, then the original string is returned.

See Also:
removeQuotes(java.lang.String)


 

 

isValidQuotedString

public static boolean isValidQuotedString(String string)

Convenience routine for checking if a string is a valid quoted string. For the purposes of this method, a string is a valid quoted string only if it is not null, starts with a quote ", ends with a quote, and any imbedded quotes are prefixed with a backslash character (\"). If there are backslash characters in the quoted string, they must be prefixed with another backslash character (\\).

See Also:
addQuotes(java.lang.String), isInvalidQuotedString(java.lang.String)


 

 

isInvalidQuotedString

public static boolean isInvalidQuotedString(String string)

Convenience routine for checking whether a string is not a valid quoted string.

See Also:
addQuotes(java.lang.String), isValidQuotedString(java.lang.String)


 

Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD