Mal auf die Schnelle dahergetippt:
Delphi-Quellcode:
function FirstNumber(const sText: string): string;
var i,j: integer;
begin
SetLength(Result, Length(sText));
j := 0;
i := 1;
while (i <= Length(sText)) and not(sText[i] in ['0'..'9']) do
inc(i);
while (i <= Length(sText)) and (sText[i] in ['0'..'9']) do
begin
inc(j);
Result[j] := sText[i];
inc(i);
end;
SetLength(Result,j);
end;
Wer mag, darf gerne korrigieren/optimieren
[edit] Hab selbst schon was gefunden und korrigiert. [/edit]