Blame view

SanlienDataRecoder_01/Untitled1/POUs/ToolBox/F_ReplaceByString.TcPOU 1.1 KB
03a3ca636   frank   初版
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  <?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>