$scan
Returns the position of a substring within a string.
$scan(
Source,
SearchFor)
Example: vOutput = $scan ("The quick brown fox", "quick")
Parameters
Parameter |
Data Type |
Description |
---|---|---|
Source | String | String in which the substring needs to be found. |
SearchFor | String | Substring to search for; can be a constant string or a syntax string with a maximum length of 256 characters. |
Return Values
Value | Meaning |
---|---|
0
|
Substring not found |
>0 |
Position of the substring within the string. |
Use
Allowed in all component types.
Using $scan
The following example finds the first occurrence
of literal o
in the source string.
vOutput = $scan("look for o", "o") ; vOutput = 2
The following example finds the literal string
quick
in the source string.
OUTPUT = $scan ("The quick brown fox", "quick") ; OUTPUT = 5
The following example finds a number (using the syntax string "#") in the source string.
vOutput = $scan ("The 1st quick brown fox came 2nd.", $syntax("#")) ; OUTPUT = 5