public class StringExaminer extends StringScanner
buffer, END_REACHED, length, pos_marker, position
Constructor and Description |
---|
StringExaminer(java.lang.String stringToExamine)
Initialize the new instance with the string to examine.
|
StringExaminer(java.lang.String stringToExamine,
boolean ignoreCase)
Initialize the new instance with the string to examine.
|
Modifier and Type | Method and Description |
---|---|
void |
appendUpToPosition(java.lang.StringBuffer strBuffer,
int pos)
Appends all characters from the current position
up to the specified position of the examined string to the given buffer.
|
protected void |
appendUpToPosition(java.lang.StringBuffer strBuffer,
int pos,
boolean peek)
Returns the a string containing all characters from the current position
up to the specified position of the examined string.
|
protected boolean |
charsAreEqual(char char1,
char char2) |
int |
findPositionOf(java.lang.String matchString)
Returns the position index of the given match string starting to look
for it from the current position.
|
protected boolean |
ignoreCase() |
protected void |
ignoreCase(boolean newValue) |
java.lang.String |
peekUpToEnd()
Returns the a string containing all characters from the current position
up to the end of the examined string.
|
java.lang.String |
peekUpToPosition(int pos)
Returns the a string containing all characters from the current position
up to the specified position of the examined string.
|
boolean |
skipAfter(java.lang.String matchString)
Increments the position pointer up to the last character that matched
the character sequence in the given matchString.
|
boolean |
skipBefore(java.lang.String matchString)
Increments the position pointer up to the first character before
the character sequence in the given matchString.
|
java.lang.String |
upToEnd()
Returns the a string containing all characters from the current position
up to the end of the examined string.
|
protected java.lang.String |
upToEnd(boolean peek)
Returns the a string containing all characters from the current position
up to the end of the examined string.
|
java.lang.String |
upToPosition(int pos)
Returns the a string containing all characters from the current position
up to the specified position of the examined string.
|
atEnd, endNotReached, endReached, getPosition, hasNext, length, markPosition, nextChar, nextNoneWhitespaceChar, peek, restorePosition, setPosition, skip, toString
public StringExaminer(java.lang.String stringToExamine)
stringToExamine
- The string that should be examinedpublic StringExaminer(java.lang.String stringToExamine, boolean ignoreCase)
stringToExamine
- The string that should be examinedignoreCase
- Specified whether or not treating the string case insensitivepublic boolean skipAfter(java.lang.String matchString)
If the matchString was found, the next invocation of method nextChar() returns the first character after that matchString.
matchString
- The string to look uppublic int findPositionOf(java.lang.String matchString)
public boolean skipBefore(java.lang.String matchString)
If the matchString was found, the next invocation of method nextChar() returns the first character of that matchString from the position where it was found inside the examined string.
matchString
- The string to look uppublic java.lang.String peekUpToEnd()
public java.lang.String upToEnd()
public java.lang.String peekUpToPosition(int pos)
public java.lang.String upToPosition(int pos)
public void appendUpToPosition(java.lang.StringBuffer strBuffer, int pos)
protected boolean charsAreEqual(char char1, char char2)
protected java.lang.String upToEnd(boolean peek)
protected void appendUpToPosition(java.lang.StringBuffer strBuffer, int pos, boolean peek)
protected boolean ignoreCase()
protected void ignoreCase(boolean newValue)