|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectthings.common.tools.StringScanner
public class StringScanner
A String Scanner. It's not for matching, parsing, or anything like that. Use if for very simple in-order string searches.
Version History
EPG - Rewrite from another project - 7 JUN 07
Constructor Summary | |
---|---|
StringScanner()
|
Method Summary | |
---|---|
void |
addpattern(java.lang.String patternName,
java.lang.String pattern)
Adds a regex pattern to the scanner. |
int |
find(java.lang.String patternName)
Find a pattern. |
int |
get()
Get the cursor position |
java.lang.String |
getData()
Get the string being scanned. |
void |
move(int offset)
Move the cursor by an offset. |
void |
reset()
Resets the cursor to the start of the string. |
boolean |
seek(java.lang.String stringToSeek)
Seek a string from the current cursor location. |
boolean |
seekinsensitive(java.lang.String stringToSeek)
Seek a string from the current cursor location. |
void |
set(int spot)
Set the cursor to the spot. |
void |
start(java.lang.String stringToScan)
Start a scan. |
java.lang.String |
substring(int numberCharacters)
Get a substring from the cursor for so many characters. |
java.lang.String |
substringFromMark(int mark)
Like the standard substring, from the mark to the current cursor minus one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringScanner()
Method Detail |
---|
public void start(java.lang.String stringToScan) throws ThingsException
stringToScan
- The string to scan.
ThingsException
- if passed a null or empty string.public void reset() throws ThingsException
ThingsException
- if the scanner was not start()'d.public boolean seek(java.lang.String stringToSeek) throws ThingsException
stringToSeek
- The string to seek.
ThingsException
- Only if the object was not start()'d.public boolean seekinsensitive(java.lang.String stringToSeek) throws ThingsException
stringToSeek
- The string to seek.
ThingsException
- Only if the object was not start()'d.public void addpattern(java.lang.String patternName, java.lang.String pattern) throws ThingsException
patternName
- The name of the pattern.pattern
- The regular expression pattern.
ThingsException
- for any problemsPattern
public int find(java.lang.String patternName) throws ThingsException
patternName
- The name of the pattern to find.
java.lang.Exception
ThingsException
public void set(int spot) throws ThingsException
spot
- The spot to set the cursor. If it is negative or past the end of the string, it will be out of bounds.
ThingsException
public void move(int offset) throws ThingsException
offset
- The offset to change the cursor. It can be positive or negative.
ThingsException
public int get()
public java.lang.String getData()
public java.lang.String substring(int numberCharacters) throws ThingsException
numberCharacters
- The number to get. Zero or negative will be ignored.
ThingsException
public java.lang.String substringFromMark(int mark) throws ThingsException
mark
- Mark point.
ThingsException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |