FIND

Function - Find position of characters in a string.

Inputs

IN : STRING   Character string
STR : STRING  String containing searched characters

Outputs

POS : DINT    Position of the first character of STR in IN, or 0 if not found

Remarks

The first valid character position is 1. A return value of 0 means that the STR string has not been found. Search is case sensitive. In LD language, the operation is executed only if the input rung (EN) is TRUE. The output rung (ENO) keeps the same value as the input rung. In IL, the first input (the string) must be loaded in the current result before calling the function. The second argument is the operand of the function.

ST Language

POS := FIND (IN, STR);

FBD Language

FindFbd.gif (1296 octets)

LD Language

(* The function is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
FindLd.gif (1540 octets)

IL Language:

Op1: LD     IN
     FIND   STR
     ST     POS

See also

+   MLEN   DELETE   INSERT   REPLACE    LEFT   RIGHT   MID