public class ExtractedString
extends java.lang.Object
Constructor and Description |
---|
ExtractedString() |
ExtractedString(java.lang.String sourceString)
Initializes using the given string
|
Modifier and Type | Method and Description |
---|---|
java.lang.Float |
asFloat()
Returns the extracted string as a float.
|
java.lang.Integer |
asInteger()
Returns the extracted string as an integer.
|
boolean |
endOfString()
Tells, whether or not the extraction ends at the end of the source string, that is, no next extraction is
possible.
|
ExtractedString |
extract(int startPos,
char terminalChar)
Initializes the extraction.
|
ExtractedString |
extract(int startPos,
char[] terminalChars)
Initializes the extraction.
|
ExtractedString |
extract(int startPos,
char[] terminalChars,
int charMinCheckIndex)
Initializes the extraction.
|
ExtractedString |
extract(int startPos,
char[] terminalChars,
int charMinCheckIndex,
char openBracket,
char closeBracket)
Initializes the extraction.
|
ExtractedString |
extract(int startPos,
char terminalChar,
char openBracket,
char closeBracket)
Initializes the extraction.
|
ExtractedString |
extract(int startPos,
int endPos)
Initializes the extraction.
|
char |
getEndChar()
Returns the character of the end of the extraction, which is usually a terminal character and not included in
the extracted string.
|
int |
getExLength()
Returns the length of the extracted sub string.
|
java.lang.String |
getExtracted()
Returns the extracted string.
|
int |
getNextPos()
Returns the next position for example to begin the next extraction.
|
int |
getNextPos(char spaceChar)
Returns the next position for example to begin the next extraction and skips all characters which are equal to
the given one.
|
int |
getNextPos(char[] spaceChars)
Returns the next position for example to begin the next extraction and skips all characters contained in the
given array.
|
int |
getStringEnd()
Returns the position of the end of the extraction.
|
int |
getStringStart()
Returns the position of the start of the extraction.
|
boolean |
hasFoundChar()
Tells whether or not the extraction was stopped by a terminating character.
|
java.lang.String |
restString(char spaceChar)
Returns the sub string of the next position to the end of the source string.
|
void |
setSource(java.lang.String string) |
void |
skipSpace(char[] spaceChars) |
static int |
skipSpace(java.lang.String sourceString,
int startPos,
char[] spaceChars)
Returns the position of the next word in the given string according to the given start position.
|
java.lang.String |
toString() |
public ExtractedString()
public ExtractedString(java.lang.String sourceString)
public static int skipSpace(java.lang.String sourceString, int startPos, char[] spaceChars)
startPos
- the minimum position.spaceChars
- the characters to skip.public ExtractedString extract(int startPos, int endPos)
startPos
- the start position from where to extract.endPos
- the end position until where to extract.public ExtractedString extract(int startPos, char[] terminalChars, int charMinCheckIndex, char openBracket, char closeBracket)
startPos
- the start position from where to start the extraction.terminalChars
- the characters at where to end the extraction. Once one of the characters appear, the
extraction is stopped.charMinCheckIndex
- the offset for the terminalChars array. Characters with index below this argument will
not be checked.openBracket
- the opening bracket. The extraction never stops between an opening and a closing
bracket.closeBracket
- the closing bracket. The extraction never stops between an opening and a closing
bracket.public ExtractedString extract(int startPos, char terminalChar, char openBracket, char closeBracket)
startPos
- the start position from where to start the extraction.terminalChar
- the character at where to end the extraction.openBracket
- the opening bracket. The extraction never stops between an opening and a closing bracket.closeBracket
- the closing bracket. The extraction never stops between an opening and a closing bracket.public ExtractedString extract(int startPos, char[] terminalChars, int charMinCheckIndex)
startPos
- the start position of the extraction.terminalChars
- the characters at which to stop the extraction. That is, the extraction stops, if one
of the given characters occurs, beginning at charMinCheckIndex.charMinCheckIndex
- an offset for the terminalChars array. All indices below charMinCheckIndex will be
ignored.public ExtractedString extract(int startPos, char[] terminalChars)
startPos
- the start position of the extraction.terminalChars
- the characters at which to stop the extraction. That is, the extraction stops, if one of
the given characters occurs.public ExtractedString extract(int startPos, char terminalChar)
startPos
- the start position of the extraction.terminalChar
- the character at where to stop the extraction.public java.lang.String restString(char spaceChar)
spaceChar
- the character to skip when finding the next position.public boolean endOfString()
public int getStringStart()
public int getStringEnd()
public char getEndChar()
public java.lang.String getExtracted()
public int getNextPos(char[] spaceChars)
spaceChars
- the characters to skip.public void skipSpace(char[] spaceChars)
public int getNextPos(char spaceChar)
spaceChar
- the character which is to be skipped.public int getNextPos()
public boolean hasFoundChar()
public int getExLength()
public java.lang.Float asFloat()
public java.lang.Integer asInteger()
public java.lang.String toString()
toString
in class java.lang.Object
public void setSource(java.lang.String string)