unit llyfunc;
interface
uses
  SysUtils, Windows, Classes,Controls, Forms,
  Buttons, ExtCtrls, strUtils,StdCtrls ; type Tmyarr=array of string;
 Procedure split(sourceStr :string;splitstr:string;  var aArray :tmyarr ) ; 
implementation    Procedure split(sourceStr :string;splitstr:string;  var aArray :tmyarr ) ;
var
        LenOfSourcestr,leftsize,tmpCount,LenOfArray:integer;//leftsize用来得到已经用过的子串长度
        tempresult:string;
        replacestr:string;begin
replacestr:=sourcestr;
lenofsourcestr:=length(sourcestr);
leftsize:=0;
tmpcount:=0;
lenofarray:=1;
  while pos(splitstr,rightstr(replacestr,lenofsourcestr-leftsize))>0  do
    begin
      leftsize:=leftsize+pos(splitstr,rightstr(replacestr,lenofsourcestr-leftsize));
      inc(lenofarray);
    end;    setlength(aarray,lenofarray);    while pos(splitstr,replacestr)>0 do
    begin
    tempresult:=copy(replacestr,0,pos(splitstr,replacestr)-1);
    aarray[tmpcount]:=tempresult;
    replacestr:=rightstr(replacestr,length(replacestr)-pos(splitstr,replacestr));
    inc(tmpcount);    end;
    aarray[tmpcount]:=replacestr;end ;
end.