Type
| Function |
Description
| Detects the position of a substring connected to IN2 within a given string connected to IN1. The character position of the first occurrence of the input string IN2 in IN1 is stored to OUT.If no occurrence of the substring connected to IN2 is found or no substring (empty string '') is applied to IN2, then OUT := 0. |
Notes
|
- The first position in a string is 1.
- Problem for calculation of position and length: Characters in WSTRING can have a size of 2 bytes or 4 bytes. Due to this, there may be calculation problems on 4-byte containing character STRINGs with 2-byte oriented position and length.
|
Parameters
| Inputs
IN1
Data type: | WSTRING |
Description: | Input string. |
IN2
Data type: | WSTRING |
Description: | Substring to be found. |
Output
OUT
Data type: | INT |
Description: | Character position of the first occurrence of the substring. |
|
Error behavior
| Error behavior
The following table shows the errors which may occur while executing the function and the value returned by the function in the corresponding error case.
Error case | Output value |
Empty string '' at IN2 | 0 |
|
Additional information
| EN/ENO behavior
The POU is only executed if TRUE is applied to the EN input. If EN = FALSE, the POU is not executed and ENO = FALSE indicates the inactivity.
If any of the errors listed under "Error behavior" occurs while executing the function, ENO is set to FALSE.
|