How to: |
The SUBSTRING function extracts a substring from a source string. If the ending position you specify for the substring is past the end of the source string, the position of the last character of the source string becomes the ending position of the substring.
SUBSTRING(source_string, start_position, length_limit)
where:
Alphanumeric
Is the string from which to extract the substring. It can be a field, a literal in single quotation marks (‘), or a variable.
Integer
Is the starting position of the substring in source_string. If the position is 0, it is treated as 1. If the position is negative, the starting position is counted backward from the end of source_string.
Integer
Is the limit for the length of the substring. The ending position of the substring is calculated as start_position + length_limit - 1. If the calculated position beyond the end of the source string, the position of the last character of source_string becomes the ending position.
The data type of the returned substring is AnV.
POSITION determines the position of the first letter I in LAST_NAME.
SUBSTRING(LAST_NAME, I_IN_NAME, I_IN_NAME+2)
For BANNING, the result is 5.
iWay Software |