替换字符串列表中字符串

//替换字符串列表中字符串

procedure StringsReplace(var S : TStrings; OldPattern, NewPattern: string; Flags: TReplaceFlags);
var i : integer;
     tmpstr : string;
begin
   for i := 0 to S.Count -1 do
   begin
     tmpstr := S[i];
     s[i] := StringReplace(tmpstr, OldPattern, NewPattern, Flags);
   end;
end;

//分割字符串,从网上搜索的也很好使
function SplitString(Source, Deli: string ): TStringList;stdcall;
var
   EndOfCurrentString: byte;
   StringList:TStringList;
begin
   StringList:=TStringList.Create;
   while Pos(Deli, Source)>0 do
   begin
     EndOfCurrentString := Pos(Deli, Source);
     StringList.add(Copy(Source, 1, EndOfCurrentString - 1));
     Source := Copy(Source, EndOfCurrentString + length(Deli), length(Source) - EndOfCurrentString);
   end;
   Result := StringList;
   StringList.Add(source);
end;

原文地址:https://www.cnblogs.com/hnxxcxg/p/2940880.html