substr
substr — returns a substring for a given location.
substr (string, start_char, length)
stringA string.
start_charThe position number of the first character of the substring.
lengthThe length of the substring.
A new string which is a substring of the input
string.
This function returns a substring of the input string starting at the
start_char position and running for
length characters. The first character in the
string is numbered zero. If start_char is greater
than the length of the string, the function returns an empty string. If
start_char is negative, it is indexed from the
end of the string. If it is negative and greater than the length of the
string, it is treated as zero—the beginning of the string.
If there are fewer characters than length in the
string, or if length is -1, then the substring
contains all characters from start_char to the end of
the string.
Gamma>substr("Acme widgets",7,3);"dge"Gamma>substr("Acme widgets",9,-1);"ets"Gamma>substr("Acme widgets",-7,4);"widg"Gamma>substr("Acme widgets",-30,4);"Acme"Gamma>