public class StringIterator
extends java.lang.Object
Constructor and Description |
---|
StringIterator(java.lang.String string) |
Modifier and Type | Method and Description |
---|---|
void |
advance()
Advance the iterator to the next character.
|
void |
advancePastWhitespace()
Advance past any whitespace characters in the str, leaving the iterator at the first non-whitespace character
following.
|
void |
advancePastWhitespaceOnSameLine() |
boolean |
atEnd() |
void |
checkAndAdvance(char c)
Verify that the current character is c, throwing an exception if it isn't, then advance to the next character.
|
char |
curr() |
int |
getIndex() |
java.lang.String |
getRemaining() |
java.lang.String |
getString() |
boolean |
isAsciiLetter() |
boolean |
isDigit() |
boolean |
isLineBreak() |
boolean |
isWhitespace() |
boolean |
isWhitespaceOnSameLine() |
boolean |
match(char value) |
boolean |
match(char value,
java.lang.StringBuilder buffer) |
boolean |
match(java.lang.String substring) |
boolean |
matchCharRange(int minChar,
int maxChar,
java.lang.StringBuilder buffer) |
boolean |
matchDigit(java.lang.StringBuilder buffer) |
boolean |
matchDigits(java.lang.StringBuilder buffer) |
char |
read()
Return the current character (same as curr()) then advance to the next one.
|
java.lang.String |
readWhitespaceDelimitedToken() |
java.lang.String |
readWhitespaceDelimitedTokenOnSameLine() |
void |
skipAheadPast(java.lang.String substr)
Search for the the next occurrence of the specified substring & advance the iterator just past it.
|
boolean |
skipAheadPastIfExists(java.lang.String substr)
Search for the the next occurrence of the specified substring & advance the iterator just past it.
|
public java.lang.String getString()
public java.lang.String getRemaining()
public int getIndex()
public boolean atEnd()
public char curr()
public char read()
public void advance()
public boolean match(char value)
public boolean match(char value, java.lang.StringBuilder buffer)
public boolean match(java.lang.String substring)
public boolean matchDigits(java.lang.StringBuilder buffer)
public boolean matchCharRange(int minChar, int maxChar, java.lang.StringBuilder buffer)
public boolean matchDigit(java.lang.StringBuilder buffer)
public void skipAheadPast(java.lang.String substr)
substr
- substring to search forpublic boolean skipAheadPastIfExists(java.lang.String substr)
substr
- substring to search forpublic void checkAndAdvance(char c)
c
- character to verify that occurs at the current iterator positionpublic boolean isLineBreak()
public boolean isWhitespace()
public boolean isDigit()
public boolean isAsciiLetter()
public boolean isWhitespaceOnSameLine()
public void advancePastWhitespace()
public void advancePastWhitespaceOnSameLine()
public java.lang.String readWhitespaceDelimitedToken()
public java.lang.String readWhitespaceDelimitedTokenOnSameLine()