Next: uppercase

Prev: strsub

substr

substr(string, start)
substr(string, start, length)
This function returns a substring of string beginning at the character numbered by start. If length is specified, then the substring has that length; otherwise, the length is given by (length(string) - (start - 1)). If start is less than 1, if the length of the substring is negative, or if the sum of start and length is greater than one more than the length of the string, then substr() throws a ~range error.

Examples:

substr("foobar", 2, 3)
     => "oob"
substr("foobar", 3)
     => "obar"
substr("foobar", 7)
     => ""