Mirror

How to strip numbers from an alphanumeric string (Views: 100)


Problem/Question/Abstract:

How to strip numbers from an alphanumeric string

Answer:

function.StripNonNums(AText: string): string;
var
  i: integer;
  r: integer;
begin
  SetLength(Result, Length(AText));
  r := 1;
  for i := 1 to Length(AText) do
    if AText[i] in ['0'..'9'] then
    begin
      Result[r] := AText[i];
      Inc(r);
    end;
  SetLength(Result, r);
end;

<< Back to main page