ColdC: Function/Method Reference: substr()


STRING substr(STRING str, INTEGER start[, INTEGER length])

This function returns a subrange of string. The subrange starts at the character specified by start and continues length characters. If length is unspecified it continues to the end of the string. If start is outside of the range of the string, or length will extend past the end of the string, the error ~range is thrown.

Examples:

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

substr("foobar", 3)
=> "obar"

substr("foobar", 7)
=> ""


Last Modified on 24 Mar 1996
Copyright © 1995, 1996, Brandon Gillespie