Documentation

string::SubStr

Method in string

string SubStr(int index) const

Returns the remainder of the string after the given index. For example; for the string "Hello", SubStr(1) returns "ello".

int index

The index at which to start. When a negative number is used, the start index is subtracted from the length of the string. For example; for the string "Hello", SubStr(-3) returns "llo".

Returns string
string SubStr(int index, int length) const

Returns a portion of the string from the index and length. For example; for the string "Hello", SubStr(1, 3) returns "ell".

int index

The index at which to start. When a negative number is used, the start index is subtracted from the length of the string. For example; for the string "Hello", SubStr(-3, 2) returns "ll".

int length

The length of the substring. When a negative number is used, the length of the source string becomes the base of the length. For example; for the string "Hello", SubStr(0, -1) returns "Hell".

Returns string