由于string类可以作为树组使用,只要对字符串进行遍历循环,就可以如 var a,s:sting; i:integer; begin s;='1+2+3' for i:=1 to length(s) to if s[i] in ['0'..'9'] then a:=a+s[i];end;数组的道理一样,给分吧,后面的别补充了,已经很详细了,不行给我发消息
var s,t: string; i: integer; begin s := '123 456 7 8 9'; t := ''; for i:=1 to length(s) do if s[i] in ['0'..'9'] then begin t := t + s[i] end else if t <> '' then begin // add t to array here t := ''; end; if t <> '' then begin // add last t to array here end; end;
var
a,s:sting;
i:integer;
begin
s;='1+2+3'
for i:=1 to length(s) to
if s[i] in ['0'..'9']
then a:=a+s[i];end;数组的道理一样,给分吧,后面的别补充了,已经很详细了,不行给我发消息
只需一条命令.字符串可以看成是字符数组, 也分给我一半分吧, 后面的别补充了, 现在是真的很详细了,不行给我发消息
s,t: string;
i: integer;
begin
s := '123 456 7 8 9';
t := ''; for i:=1 to length(s) do
if s[i] in ['0'..'9'] then
begin
t := t + s[i]
end
else if t <> '' then
begin
// add t to array here
t := '';
end;
if t <> '' then
begin
// add last t to array here
end;
end;