-
- string range string first last
Returns a range of consecutive characters from
string, starting with the character whose index is
first and ending with the character whose index is
last. An index of 0 refers to the first character of the string.
first and
last may be specified as for the
index method. If
first is less than zero then it is treated as if it were zero, and if
last is greater than or equal to the length of the string then it is treated as if it were
end. If
first is greater than
last then an empty string is returned.
For example:
string range "abcde" 0 3
returns "
abcd" and
string range "abcdefgh" 3 5
returns "
def".
If you do this:
string range "abcdefgh" 5 3
you will get "" and not an error.
See also edit