Range
Overview
Used to identify range in a sequence.
Use case
You can use Range class when you need to specify a part of some sequence, for example Binary class uses Range to to read part of the data:
var Bin := new Sugar.Binary(Sugar.String("Hello World").ToByteArray);
writeLn(new Sugar.String(Bin.Read(Sugar.Range.MakeRange(6, 5)))); //outputs "World"
Location
Properties
Length
Gets or sets number of items in range.
property Length: Int32 read write;
Int32 Length { get; set; }
var Length: Int32 { get{} set{} }
Int32 Length { __get; __set; }
Property Length() As Int32
Location
Gets or sets starting index of range.
property Location: Int32 read write;
Int32 Location { get; set; }
var Location: Int32 { get{} set{} }
Int32 Location { __get; __set; }
Property Location() As Int32
Class Methods
MakeRange
Creates a new Range with specified parameters.
Parameters:
- aLocation: Starting index of range.
- aLength: Number of items in range.