FindAndReplace

The function finds a string, which may occur more than once, in another string and replaces it with another string.
The function returns:
- The number of replaced strings.
- The value 0 if the string was not found.
The function stops the checking of the input length after Parameterlist.cMaxCharacters
characters in order to avoid an infinite loop.
Return value
Name | Type | Description |
---|---|---|
FindAndReplace | UDINT | Finds a string that may occur more than once in another string and replaces it with another string. |
Inputs
VAR_INPUT
pSrcString : POINTER TO STRING;
pDeleteString : POINTER TO STRING;
pInsertString : POINTER TO STRING;
pDstString : POINTER TO STRING;
nDstSize : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
pSrcString | POINTER TO STRING | Pointer to the STRING variable whose string is to be searched (input string). |
pDeleteString | POINTER TO STRING | Pointer to the STRING variable whose string is to be replaced (input string). |
pInsertString | POINTER TO STRING | Pointer to the STRING variable whose string is to replace the other string (input string). |
pDstString | POINTER TO STRING | Pointer to the resulting STRING variable (output string) |
nDstSize | UDINT | Size of the resulting STRING variable (output string) in bytes; the SIZEOF() operator can be used for the assignment. |
Requirements
Development environment | Target platform | PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT v3.1.4022 | PC or CX (x86, x64, Arm®) | Tc2_Utilities (System) >=3.3.35.0 |