public class StringParser extends Object
| Constructor and Description |
|---|
StringParser(String input)
Creates new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext()
Returns true if next character is available to read.
|
String |
lookupCharacter()
Looks up character without moving the cursor.
|
String |
lookupCharacter(String defaultEnd)
Looks up character without moving the cursor.
|
String |
readCharacter()
Reads one character.
|
String |
readCharacter(String defaultEnd)
Reads one character.
|
String |
readTillStop(String stopCharacters)
Reads until one of the stop character or end of the string is reached.
|
String |
toString() |
public StringParser(String input)
input - input string which will be parsedpublic boolean hasNext()
public String readCharacter()
IndexOutOfBoundsException - if there is no next characterpublic String readCharacter(String defaultEnd)
defaultEnd - string which is returned if cursor is at the endpublic String lookupCharacter()
IndexOutOfBoundsException - if there is no next characterpublic String lookupCharacter(String defaultEnd)
defaultEnd - string which is returned if cursor is at the endpublic String readTillStop(String stopCharacters)
stopCharacters - set of stop charactersCopyright © 2016. All rights reserved.