Returns the location of the first occurrence a string or character in another string.
Informal Syntax:
Formal Syntax:
FIND( In1:=expression, In1:=expression )
Parameter | Type | Description |
---|---|---|
In1 | ANY_STRING | The string to search. |
In2 | ANY_CHARS | The string or character to find. |
The function is overloaded and accepts a range of types for the In1 and In2 parameters:
The function FIND returns the character offset of the first occurrence of In2 in string In1.
If the string In2 is found in In1, the return value is a 1-based character offset. For example, if In2 is found at the start of In1, the return value is 1.
If string In2 is not found in string In1, the function returns 0 (zero). If the parameter In2 is an empty string, the function returns 0 (zero).
Example | Return Value |
---|---|
FIND('condition', 'c') | UINT#1 |
FIND('condition', 'o') | UINT#2 |
FIND("Something else", "Some Text") | UINT#0 |
FIND('FINS', '') | UINT#0 |
IEC 61131-3 Second Edition: Table 29.9.
IEC 61131-3 Third Edition: Table 34.9.
Note: The function allows different string types as parameters. The IEC 61131-3 Third Edition standard states this should be an error.
To learn about other String Functions.
To learn about other IEC 61131-3 Common Elements.
For the meaning of terms used in Fernhill SCADA.