substring( )
string
substring(string s, number index, number length
)string
substring(string s, number index
)
The substring( )
function returns the substring of s
starting at index
and continuing for length
characters. The first character
in the string is at position 1 (not 0, as in Java and JavaScript).
For example, substring('Charming
cat'
, 1,
5)
returns "Charm
".
If length
is omitted, then the
substring to the end of the string is returned. For example,
substring('Charming
cat'
, 10)
returns "cat
". As usual, any type of object may
be passed to this function in place of the normal argument, in
which case it is automatically converted to a string before
extracting the substring.