ns=2;s=DEPRAG Smart/Utilities/StringOperations/Replace
Replaces all occurrences of a specified string in a text with another one.
In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:
VAR
bStringReplace : BOOL;
OutputDataStringReplace : ST_StringOutputData;
hrStringReplace : HRESULT;
fbStringOperations : FB_StringOperations;
END_VAR
hrStringReplace := fbStringOperations.StringReplace(
bExecute := bStringReplace,
ConnectionHandle := depragSmartConnection.ConnectionHandle,
StringToReplaceIn := 'IamATestString',
StringToReplaceInLength := SIZEOF('IamATestString'),
OldString := 'Test',
OldStringLength := SIZEOF('Test'),
NewString := 'Beautiful',
NewStringLength := SIZEOF('Beautiful'),
IgnoreCase := TRUE,
OutputData => OutputDataStringReplace);
IF hrStringReplace <> S_FALSE THEN
bStringReplace := FALSE;
END_IF
For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".