Find String (FIND)
The FIND instruction locates the starting position of a specified string within another string.
The FIND instruction searches the Source string for the Search string. If the instruction finds the Search string, the Result shows the starting position of the Search string within the Source string. Otherwise the Results is zero.
Available Languages
Ladder Diagram
FactoryTalk Design Studio
DSL - Ladder DiagramFIND(Source,Search,Start,Result);
Operands
There are data conversion rules for mixed data types within an instruction. See Data Conversion.
Ladder Diagram
Operand | Type | Format | Description | Notes |
---|---|---|---|---|
Source | ANY_STRING | Tag | The string to search in | String types are:
|
Search | ANY_STRING | Tag | The string to find | |
Start | SINT
INT
DINT | Immediate
tag | The position in Source to start the search | Enter a number between 1 and the DATA size of the Source. |
Result | DINT
SINT
INT | Tag | The position in Source where search string was found |
Affects Math Status Flags
No
Major/Minor Faults
A minor fault will occur if: | Fault Type | Fault Code |
---|---|---|
The LEN value of the string tag is greater than the DATA size of the string tag. | 4 | 51 |
The Start value is invalid, or the Source string is empty. | 4 | 56 |
None specific to this instruction. See Common Attributes for operand related faults.
Execution
Ladder Diagram
Condition | Action |
---|---|
Prescan | N/A |
Rung-condition-in is false | N/A |
Rung-condition-in is true | The instruction executes. |
Postscan | N/A |
Provide Feedback