Attention

IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.

FIND

Searches for a substring within a string.

IEC 61131-3

Section 2.5.1.5.7

Support

Not yet supported

Signatures

#

Input (IN1)

Input (IN2)

Return Type

Support

1

STRING

STRING

INT

Not yet supported

2

WSTRING

WSTRING

INT

Not yet supported

Description

FIND(IN1, IN2) returns the position of the first occurrence of IN2 within IN1. Positions are 1-based. If IN2 is not found, the function returns 0.

Example

result := FIND('Hello World', 'World');   (* result = 7 *)
result := FIND('Hello World', 'xyz');     (* result = 0 *)
result := FIND('ABCABC', 'BC');           (* result = 2 *)

See Also

  • REPLACE — string replacement

  • MID — middle substring

  • LEN — string length