Class ArgumentReader
java.lang.Object
org.teleight.teleightbots.commands.builder.parser.ArgumentReader
Class representing an argument reader.
-
Constructor Summary
ConstructorsConstructorDescriptionArgumentReader(String input) Constructs an ArgumentReader with the specified input string. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if there are more characters to read in the input string.@NotNull StringReads the remaining characters from the input string.@NotNull StringreadWord()Reads the next word from the input string.voidResets the cursor to the start of the input string.
-
Constructor Details
-
ArgumentReader
Constructs an ArgumentReader with the specified input string.- Parameters:
input- the input string from which arguments are read
-
-
Method Details
-
hasRemaining
public boolean hasRemaining()Checks if there are more characters to read in the input string.- Returns:
- true if there are more characters to read, false otherwise
-
readWord
Reads the next word from the input string.A word is defined as a sequence of characters separated by spaces. The cursor is moved to the position after the read word.
- Returns:
- the read word
-
readRemaining
Reads the remaining characters from the input string.The cursor is moved to the end of the input string.
- Returns:
- the remaining characters
-
resetCursor
public void resetCursor()Resets the cursor to the start of the input string.
-