|
LPEX 3.6.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.lpex.core.LpexStringTokenizer
public final class LpexStringTokenizer
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 |
---|
public LpexStringTokenizer(String str)
Method Detail |
---|
public boolean hasMoreTokens()
true
if there are more tokens available from this
tokenizer's string; false
otherwisepublic String nextToken()
NoSuchElementException
- if there are no more tokens in this
tokenizer's stringpublic boolean hasMoreElements()
hasMoreTokens()
method. The method is provided so that this class can implement the
Enumeration
interface.
hasMoreElements
in interface Enumeration
true
if there are more tokens;
false
otherwiseEnumeration
,
hasMoreTokens()
public Object nextElement()
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.
nextElement
in interface Enumeration
NoSuchElementException
- if there are no more tokens in this
tokenizer's stringEnumeration
,
nextToken()
public int countTokens()
nextToken()
method can be called before it generates an
exception.
nextToken()
public String remainingText()
public static String[] split(String str)
public static String addQuotes(String string)
"
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.
removeQuotes(java.lang.String)
public static String removeQuotes(String string)
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.
string
- assumes that isValidQuotedString(string)
returned
true
addQuotes(java.lang.String)
,
trimQuotes(java.lang.String)
,
isValidQuotedString(java.lang.String)
,
isInvalidQuotedString(java.lang.String)
public static String trimQuotes(String string)
removeQuotes(java.lang.String)
public static boolean isValidQuotedString(String string)
"
, 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 (\\
).
addQuotes(java.lang.String)
,
isInvalidQuotedString(java.lang.String)
public static boolean isInvalidQuotedString(String string)
addQuotes(java.lang.String)
,
isValidQuotedString(java.lang.String)
|
LPEX 3.6.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |