Class StringRange
Namespace: Void.Minecraft.Commands.Brigadier.Context
Assembly: Void.Minecraft.dll
Represents a half-open character range in command input.
public record StringRange : IEquatable<StringRange>Inheritance
Implements
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
StringRange(int, int)
Represents a half-open character range in command input.
public StringRange(int Start, int End)Parameters
Start int
The inclusive start index.
End int
The exclusive end index.
Properties
End
The exclusive end index.
public int End { get; init; }Property Value
IsEmpty
Gets whether the range has zero length.
public bool IsEmpty { get; }Property Value
Length
Gets
public int Length { get; }Property Value
Start
The inclusive start index.
public int Start { get; init; }Property Value
Methods
At(int)
Creates an empty range at a position.
public static StringRange At(int pos)Parameters
pos int
The start and end position.
Returns
The empty range.
Between(int, int)
Creates a range between two supplied indexes without validation.
public static StringRange Between(int start, int end)Parameters
start int
The inclusive start.
end int
The exclusive end.
Returns
The range.
Encompassing(StringRange, StringRange)
Creates the smallest range containing two ranges.
public static StringRange Encompassing(StringRange a, StringRange b)Parameters
The first range.
The second range.
Returns
A range from the lesser start through the greater end.
Get(IImmutableStringReader)
Extracts this range from a reader’s source.
public string Get(IImmutableStringReader reader)Parameters
reader IImmutableStringReader
The source provider.
Returns
The selected substring.
Get(string)
Extracts this range from a string.
public string Get(string value)Parameters
value string
The source string.
Returns
The selected substring.