F_ReplaceByString.TcPOU 1.1 KB
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.9">
  <POU Name="F_ReplaceByString" Id="{9e469127-3f5d-494f-b3f4-8d9b68bb383d}" SpecialFunc="None">
    <Declaration><![CDATA[FUNCTION F_ReplaceByString : T_MaxString			(* Find first content & replace *)
VAR_INPUT
		sSource			: T_MaxString;	(* Data Source *)
		sFindContent	: T_MaxString;	(* Find feature *)
		sReplaceContent	: T_MaxString;	(* replace content *)
END_VAR
VAR
	i : INT;	

END_VAR
]]></Declaration>
    <Implementation>
      <ST><![CDATA[(*
F_ReplaceByString := sSource; 
*)
IF find(sSource , sFindContent)> 0  THEN
	F_ReplaceByString := sSource; 
i := 	find(sSource , sFindContent);
	F_ReplaceByString := REPLACE(sSource , sReplaceContent ,Len(sFindContent) , find(sSource,sFindContent));
END_IF]]></ST>
    </Implementation>
    <LineIds Name="F_ReplaceByString">
      <LineId Id="26" Count="1" />
      <LineId Id="33" Count="0" />
      <LineId Id="22" Count="0" />
      <LineId Id="34" Count="1" />
      <LineId Id="23" Count="0" />
      <LineId Id="20" Count="0" />
    </LineIds>
  </POU>
</TcPlcObject>