ExtractStrings函数使用例子

program Project2;
{$APPTYPE CONSOLE}
uses
  SysUtils,
  Classes;

var
  aSource:string;
  aStr:string;
  aCount,i:Integer;
  aStrings:TStringList;
begin
  aSource := 'ABC|...   DEF|#### GHI|"不会被分开|# 我我我"';
   AStrings := TStringList.Create;
   try
     ACount := ExtractStrings(['|'], [' ', '#', '.'],PChar(ASource), AStrings);
     for i := 0 to aCount - 1 do
     begin
     Write(AStrings[i]);
     Writeln;
     end;
   finally
     AStrings.Free;
   end;
   Readln;
end.

 

结果:

ABC

DEF

GHI

"不会被分开|# 我我我"

 

 

你可能感兴趣的:(ExtractStrings函数使用例子)