- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi字符串中取数字
function TForm1.getNumberFromStr(strIn: string; sFlag: string): string;
var
i: Integer;
tempStr: string;
begin
tempStr := '';
if Length(strIn) = 0 then
begin
Result := '';
exit;
end;
for i := 1 to strIn.Length do
begin
if strIn[i] = sFlag then //截取到sFlag位置结束
Break;
if IsNumber(strIn[i]) then //isNumber--System.Character
begin
tempStr := tempStr + strIn[i];
end;
end;
Result := tempStr;
end;