2 Instruction Descriptions
2-526
NJ-series Instructions Reference Manual (W502)
FIND
The FIND instruction searches a specified text string for the position of a specified text string.
The FIND instruction searches for search key In2 in string to search In1. The position of In2 from the
start of In1 is assigned to search result Out. If In2 is not found in In1, Out is 0.
The following example is for when In1 is ‘ABCDEF’ and In2 is ‘CD’. The value of variable abc will be
UINT#3.
Instruction Name FB/FUN Graphic expression ST expression
FIND Find String FUN Out:=FIND(In1, In2);
Variables
Name Meaning I/O Description Valid range Unit Default
In1 String to
search
Input
Text string to search
Depends on data type. --- ''
In2 Search key Text string to search for
Out Search
result
Output Search result 0 to 1985 --- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In1 OK
In2 OK
Out OK
Function
(@)FIND
EN ENO
In1 Ou
In2
abc:=FIND(‘ABCDEF’, ‘CD’);
LD ST
abc
‘ABCDEF’
‘CD’
FIND
EN ENO
In1
In2
UINT#3
Out=abc
‘ABCDEF’
In1
‘CD’
In2
Searches for position of In2 in In1.