|Command||basic.scan Function/BASIC Program
Applicable release versions: AP 6.2, R91
|Category||BASIC Program (486)|
|Description||searches through a given "string.expression" for the first occurrence of up to three user-definable character(s) specified by "search.delimeter(s)" in addition to the system delimeters: subvalue, value, and attribute. If the delimeter is found, "scan" returns the numeric position at which the occurence was found. The user-defined characters must be separated by a system delimeter (' " ).
If the specified search delimeters or any system delimeters are not found, "0" (zero) is returned.
d.position = scan(The "first" or 'second' name.,':AM:") This returns the value, "5", to the variable "d.position", since the first occurrence of either ' or " is found in the fifth position of the string. on scan("abcdefg","c":VM:"e":VM:"g") goto 10,20,30,40,50,60,70 This example exploits the fact that "scan" returns a number indicating the position of the search character. For instance, if "c" is found then it will goto statement label 30. loop input ans,1 until scan('abc',ans) do repeat 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.