FIND (find sub-string)

The FIND instruction locates and provides the position of sub-strings within strings.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
FIND
FIND
FIND parameters
Parameter
Parameter Type
Data Type
Description
EN
Input
BOOL
Instruction enable.
  • TRUE: Locate position within strings.
  • FALSE: No locate operation.
Applies to ladder diagram programs.
In
Input
STRING
Any non-empty string.
Pat
Input
STRING
Any non-empty string (Pattern).
FIND
Output
DINT
Output is:
  • 0 if the sub string Pat is not found.
  • The position of the first character of the first occurrence of the sub-string Pat (first position is 1).
This instruction is case sensitive.
ENO
Output
BOOL
Enable output.
Applies to ladder diagram programs.

FIND examples

FIND function block diagram example
FIND function block diagram example
FIND ladder diagram example
FIND ladder diagram example
FIND structured text example
FIND structured text example
(* ST Equivalence: *) complete_string := 'ABCD' + 'EFGH'; (* complete_string is 'ABCDEFGH ' *) found := FIND (complete_string, 'CDEF'); (* found is 3 *)
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal