Cold Help System: Programming: ColdC Reference Manual: Functions: String: 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)
=> ""


crypt() | explode() | lowercase() | match_begin() | match_pattern() | match_regexp() | match_template() | pad() | regexp() | strcmp() | strfmt() | strgraft() | strlen() | strsed() | strsub() | substr() | uppercase() | match_crypted() | split() | stridx()


the Cold Dark