# CODESYS FIND

Instructions · `FIND` · verification: source checked

FIND is a CODESYS Standard library string function declared as FUNCTION FIND : INT. It searches for the first occurrence of substring STR2 in string STR1 and returns the character position. If STR2 is not found in STR1, it returns 0.

## Specification

| Property | Value |
|---|---|
| Language | structured text |
| Code | FIND |
| Group | String Functions |
| Syntax | FIND(STR1, STR2) |
| Dialect | CODESYS |

### Parameters

| Name | Data type | Description |
|---|---|---|
| FIND | INT | Character position of the first occurrence of STR2 in STR1; 0 if no occurrence is found. |
| STR1 | STRING(255) | String within which STR2 is searched. |
| STR2 | STRING(255) | String whose position is searched in STR1. |

## Study notes

- Example in ST: arINT1 := FIND('abcdef','de'); returns 4.

## Sources

1. [Beckhoff Information System](https://infosys.beckhoff.com/content/1033/tcplclib_tc2_standard/74414091.html) (accessed 2026-10-26)
2. [CODESYS Group](https://content.helpme-codesys.com/en/libs/Standard/Current/String-Functions/FIND.html) (accessed 2026-10-26)

---

Source page: https://machineschema.com/instruction/iec-find  
JSON: https://machineschema.com/instruction/iec-find.json  
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Cite Machine Schema and the original sources.
