Type
| Function |
Description
| Inserts a string connected to IN2 in a given string connected to IN1. The input string at IN2 is inserted in IN1 after character position P. |
Notes
|
- P cannot be 0. The first position in a string is 1. If you want to insert a string before another use the CONCAT function.
- Do not use the same string as input and output string because the output string will add up until the output string is too short and the string is cleared.
- When the string output is longer than 80 characters and the FU/FB is directly connected to another FU/FB, temporary string variables of size 80 are used. Calculation/usage will fail. Use an intermediate local variable in-between.
|
Parameters
| Inputs
IN1
Data type: | WSTRING |
Description: | Input string. |
IN2
Data type: | WSTRING |
Description: | Second string to be inserted in IN1. |
P
Data type: | ANY_INT |
Description: | Character position where string IN2 is inserted. |
Output
OUT
Data type: | WSTRING |
Description: | Output string. |
|
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 |
P <= 0 | Empty string '' |
P > len(IN1)(len(...) = actual string length) | Empty string '' |
IN2 == OUT | Empty string '' |
Resulted string too short | Empty string '' |
If the listed error occurs, a string error is written to the Online log in the MESSAGES window.
Note
Controller stop on string error: The controller can be automatically stopped when a string error occurs. This allows you to locate the error in your project. To enable the automatic stop of the controller in case of a string error, activate the button in the Cockpit toolbar of the controller. |
|
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.
|