Delphi Split function

xiaoxiao2021-03-05  22

Procedure TForm1.Button1Click (Sender: TOBJECT); VAR S1: TSTRINGLIST; Begin S1: = Split ('111111: 2222: 33333: 44444', ':'); Memo1.Lines.Addstrings (S1); S1); S1.Free; end Function split (s, s1: string): tstringlist; begin result: = TSTRINGLIST.CREATE; While Pos (S1, S)> 0 Do Begin Result.Add (Copy (S, 1, POS (S1, S) -1 )); Delete (S, 1, POS (S1, S)); end; result.add (s); end;

Procedure TForm1.Button1Click (Sender: TOBJECT); VAR S1: TSTRINGLIST; Begin S1: = Split ('111111: 2222: 33333: 44444', ':'); Memo1.Lines.Addstrings (S1); S1); S1.Free; end ;

转载请注明原文地址:https://www.9cbs.com/read-32542.html

New Post(0)