查询字符串第一次出现的数字
var
str, lnum: string;
i, flag: Integer;
begin
str := 'er12rr3456';
flag := 0;
i := 1;
while i < Length(str) do
begin
if str[i] in ['0'..'9', '.'] then
begin
flag := 1;
lnum := lnum + str[i];
end
else
begin
if flag = 1 then
begin
ShowMessage(lnum);
Break;
end
else
begin
ShowMessage(str[i]);
end;
end;
i := i + 1;
end;
ShowMessage('结束了 '+IntToStr(i));
end;