Extracts a segment of a character string.
|source||a character string, or an expression that evaluates to a character string|
|position||a number, or an expression that evaluates to a number|
|length||a number, or an expression that evaluates to a number|
Character string, containing a string extracted from source, whose first character is position characters into source, and whose length is length characters.
Use $substring to extract a portion of source. The resulting string contains length characters, starting position characters into source.
If source is not a character data type, it is converted to a character data type before the function is applied.
If position is beyond the end of source or if length is zero or negative, the result is the null string.
If position+length is longer than source, the result consists of all characters from position to the end of source.
$substring(“the quick brown fox jumped”,7,5)
Extracts “ick b” from the string.
Evaluates to ” ” (the number is converted to a string).
Evaluates to “9” (the number is converted to a string).