Đây là đoạn code tách chuỗi số từ chuỗi ban đầu
Code:
procedure tachso;
var
i,j:longint;
begin
n:=0;
i:=1;
while i<=length(s) do
begin
j:=i;
if (s[i]>='0') and (s[i]<='9') then
begin
inc(n);
so[n]:='';
end;
while (s[j]>='0') and (s[j]<='9') and (j<=length(s)) do
begin
inc(j);
so[n]:=so[n]+s[j];
s[j]:='?';
end;
while (so[n][1]=0) and (length(so[n])>1) do delete(s,1,1);
i:=j;
end;
while pos(s,'??')>0 do delete(s,pos(s,'??'),1);
end;