var s:string; i,count:integer; begin count :=0; s:='aa-sss-dd-ee'; for i:=1 to length(s) do begin if s[i]='-' then count :=count+1; end; end;
var tt:tstringlist; i:integer; test:string; begin test:='aaa-aaaaa-aaa'; tt:=tstringlist.create; tt.Delimiter:='-'; tt.DelimitedText:=test; for i:=0 to tt.count-1 do //有tt.count-1个'-' begin showmessage(tt[i]); end; tt.free; end;
var aa:String; i,count:integer; begin for i:=1 to length(s) do begin if s[i]='-' then count :=count+1; end; end;
s:string;
i,count:integer;
begin
count :=0;
s:='aa-sss-dd-ee';
for i:=1 to length(s) do
begin
if s[i]='-' then count :=count+1;
end;
end;
tt:tstringlist;
i:integer;
test:string;
begin
test:='aaa-aaaaa-aaa';
tt:=tstringlist.create;
tt.Delimiter:='-';
tt.DelimitedText:=test;
for i:=0 to tt.count-1 do //有tt.count-1个'-'
begin
showmessage(tt[i]);
end;
tt.free;
end;
aa:String;
i,count:integer;
begin
for i:=1 to length(s) do
begin
if s[i]='-' then
count :=count+1;
end;
end;