WFIND

WFIND 1:

The function WFIND searches for a part in WSTRING.
WFIND (STR1, STR2) means: Find the position of the first character of first occurrence of STR2 in STR1. If STR2 does not occur in STR1, then OUT := 0 applies.

FUNCTION WFIND: INT

VAR_INPUT
    STR1 : WSTRING(255);
    STR2 : WSTRING(255);
END_VAR

Example in IL:

LD “SUXYSI“
WFIND “XY“
ST Var1 (*Result is 3*)

Example in ST:

Var1 := WFIND (“SUXYSI“,“XY“);

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v3.0.0

PC or CX (x86)

Tc2_Standard