CommandAPI 9.7.0
An API for the command UI introduced in Minecraft 1.13
|
A range within a string, i.e. More...
Public Member Functions | |
StringRange (final int start, final int end) | |
Creates a new StringRange with the given start and end index. More... | |
int | getStart () |
Returns the start of this StringRange (inclusive). More... | |
int | getEnd () |
Returns the end of this StringRange (exclusive). More... | |
String | get (final ImmutableStringReader reader) |
Applies this range to the complete String of the passed ImmutableStringReader , returning all characters from it that lie within this range. More... | |
String | get (final String string) |
Returns the substring of the passed string, that is defined by this range. More... | |
boolean | isEmpty () |
Checks if this range is empty, i.e. More... | |
int | getLength () |
Returns the length of this string range. More... | |
boolean | equals (final Object o) |
int | hashCode () |
String | toString () |
Static Public Member Functions | |
static StringRange | at (final int pos) |
Returns a StringRange containing no index. More... | |
static StringRange | between (final int start, final int end) |
Returns a StringRange with the given start and end indices. More... | |
static StringRange | encompassing (final StringRange a, final StringRange b) |
Returns a StringRange} that wraps around both passed StringRanges. More... | |
A range within a string, i.e.
the start and end values of a substring.
com.mojang.brigadier.context.StringRange.StringRange | ( | final int | start, |
final int | end | ||
) |
Creates a new StringRange with the given start and end index.
start | the start index (inclusive) |
end | the end index (exclusive) |
|
static |
Returns a StringRange containing no index.
pos | the minimum and maximum index of the range |
|
static |
Returns a StringRange with the given start and end indices.
start | the start index (inclusive) |
end | the end index (exclusive) |
|
static |
Returns a StringRange} that wraps around both passed StringRanges.
a | the first StringRange |
b | the second StringRange |
String com.mojang.brigadier.context.StringRange.get | ( | final ImmutableStringReader | reader | ) |
Applies this range to the complete String of the passed ImmutableStringReader
, returning all characters from it that lie within this range.
Equivalent to: reader.getString().substring(range.getStart(), range.getEnd()
reader | the string reader to read from |
String com.mojang.brigadier.context.StringRange.get | ( | final String | string | ) |
Returns the substring of the passed string, that is defined by this range.
Equivalent to: string.substring(range.getStart(), range.getEnd()
string | the string to get the substring from |
int com.mojang.brigadier.context.StringRange.getEnd | ( | ) |
Returns the end of this StringRange (exclusive).
int com.mojang.brigadier.context.StringRange.getLength | ( | ) |
Returns the length of this string range.
int com.mojang.brigadier.context.StringRange.getStart | ( | ) |
Returns the start of this StringRange (inclusive).
boolean com.mojang.brigadier.context.StringRange.isEmpty | ( | ) |
Checks if this range is empty, i.e.
contains not even a single index.