Extract a substring from a string
String_Type substr (String_Type s, Integer_Type n, Integer_Type len)
The substr
function returns a substring with length len
of the string s
beginning at position n
. If len
is
-1
, the entire length of the string s
will be used for
len
. The first character of s
is given by n
equal
to 1.
substr ("To be or not to be", 7, 5);
returns "or no"
The expression substr(s, n, 1)
is equivalent to the array
index expression s[n-1]
.
is_substr, strlen