FINDSTR |
![]() ![]() ![]() |
The FINDSTR statement searches a dynamic array for a given substring in any position.
Format
FINDSTR 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 FINDSTR statement searches dyn.array for a field, value or subvalue containing string. This need not be the entire field, value or subvalue. 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 ABCFMDEFVMGHIVMJKLFMMNOVMPQRSMSTU
FINDSTR 'KL' IN X SETTING F, V, S
The above FINDSTR would return F = 2, V = 3, S = 1
See also: DEL, DELETE(), EXTRACT(), FIND, INS, INSERT(), LISTINDEX(), LOCATE, LOCATE(), REPLACE() |