var s:String; i:integer; s:='AB01-CD30'; for i:=1 to Length(s) do if Ord(s[i]) in [Ord('0')..ord('9')] then ...
var s:String; i:integer; s:='AB01-CD30'; for i:=1 to Length(s) do if Ord(s[i]) in [Ord('0')..ord('9')] then ...
function GetNumberFromStr(aStr: String): String; var i: integer; begin Result := ''; for i:=1 to Length(aStr) do if Ord(aStr[i]) in [Ord('0')..ord('9')] then Result := Result + aStr[i]; end;
用copy();
取一个字符串的第N个字符的函数是那个啦?
用copy();
RE;好像是有一个用下标取的吧
i:integer;
s:='AB01-CD30';
for i:=1 to Length(s) do
if Ord(s[i]) in [Ord('0')..ord('9')] then
...
i:integer;
s:='AB01-CD30';
for i:=1 to Length(s) do
if Ord(s[i]) in [Ord('0')..ord('9')] then
...
var
i: integer;
begin
Result := '';
for i:=1 to Length(aStr) do
if Ord(aStr[i]) in [Ord('0')..ord('9')] then
Result := Result + aStr[i];
end;
因为你用pos,copy这些也是需要去遍历字符串