FIND |
![]() ![]() ![]() |
The FIND statement searches a dynamic array for a given string in any position.
Format
FIND string IN dyn.array {, occurrence} SETTING field{, value {, subvalue}} {THEN statement(s)} {ELSE statement(s)}
where
At least one of the THEN and ELSE clauses must be present.
The FIND statement searches dyn.array for a field, value or subvalue equal to string. If found, the position of string within dyn.array is returned in the field, value, and subvalue variables and the THEN clause is executed. If not found or dyn.array is a null string, the field, value, and subvalue variables are unchanged and the ELSE clause is executed.
Use of the $NOCASE.STRINGS compiler directive makes the comparison case insensitive.
Example
Variable X contains AFMBVMCVMDFMEVMFSMG
FIND 'D' IN X SETTING F, V, S
The above FIND would return F = 2, V = 3, S = 1
See also: DEL, DELETE(), EXTRACT(), FINDSTR, INS, INSERT(), LISTINDEX(), LOCATE, LOCATE(), REPLACE() |