Methods Summary |
---|
protected boolean | charsAreEqual(char char1, char char2)
return ( this.ignoreCase() )
? ( Character.toUpperCase(char1) == Character.toUpperCase( char2 ) )
: ( char1 == char2 ) ;
|
protected boolean | ignoreCase()
return ignoreCase ;
|
protected void | ignoreCase(boolean newValue) ignoreCase = newValue ;
|
public java.lang.String | peekUpToEnd()Returns the a string containing all characters from the current position
up to the end of the examined string.
The character position of the examiner is not changed by this
method.
return this.upToEnd( true ) ;
|
public boolean | skipAfter(java.lang.String matchString)Increments the position pointer up to the last character that matched
the character sequence in the given matchString.
Returns true, if the matchString was found, otherwise false.
If the matchString was found, the next invocation of method nextChar()
returns the first character after that matchString.
char ch = '-" ;
char matchChar = ' " ;
boolean found = false ;
int index = 0 ;
if ( ( matchString == null ) || ( matchString.length() == 0 ) )
return false ;
ch = this.nextChar() ;
while ( ( endNotReached( ch ) ) && ( ! found ) )
{
matchChar = matchString.charAt( index ) ;
if ( this.charsAreEqual( ch, matchChar ) )
{
index++ ;
if ( index >= matchString.length() ) // whole matchString checked ?
{
found = true ;
}
else
{
ch = this.nextChar() ;
}
}
else
{
if ( index == 0 )
{
ch = this.nextChar() ;
}
else
{
index = 0 ;
}
}
}
return found ;
|
public boolean | skipBefore(java.lang.String matchString)Increments the position pointer up to the first character before
the character sequence in the given matchString.
Returns true, if the matchString was found, otherwise false.
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.
boolean found ;
found = this.skipAfter( matchString ) ;
if ( found )
this.skip( 0 - matchString.length() ) ;
return found ;
|
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.
Depending on the peek flag the character position of the examiner
is unchanged (true) after calling this method or points behind the strings
last character.
char result = '-" ;
int lastPosition = 0 ;
StringBuffer buffer = new StringBuffer( 100 ) ;
lastPosition = this.getPosition() ;
result = this.nextChar() ;
while ( endNotReached( result ) )
{
buffer.append( result ) ;
result = this.nextChar() ;
}
if ( peek )
this.setPosition( lastPosition ) ;
return buffer.toString() ;
|
public java.lang.String | upToEnd()Returns the a string containing all characters from the current position
up to the end of the examined string.
The character position is put to the end by this method.
That means the next invocation of nextChar() returns END_REACHED.
return this.upToEnd( false ) ;
|