The scan() function searches through a specified str.exp for the first occurrence of up to three user-definable characters specified by search.delimiters in addition to the system delimiters value, subvalue, and attribute.
scan(str.exp, search.delimiters)
str.exp | Specifies the string to search. |
search.delimiters | Specifies up to three user-definable characters to be searched for in addition to the system delimiters value, subvalue, and attribute. The user-defined characters must be separated by a system delimiter (’ " \). |
If the delimiter is found, scan returns the numeric position where the occurrence was found.
If the specified search delimiters or any system delimiters are not found, 0 is returned.
If no match is found the result is 0.
This returns the value, 5, to the variable d.position, because the first occurrence of either \’\ or \"\ is found in the fifth position of the string.
String = \The "first" or ’second’ name.\ d.position = scan(string,\’\:@am:\"\)
If ans is either an a, b, or c, the loop is terminated. Notice that a null value for ans results in a 0 from the scan() function.
loop input ans,1 until scan(’abc’,ans) do repeat