Anyone can help with how can I find the first full Word that contains numbers? I have an adress, for example:
procedure TForm1.Button4Click(Sender: TObject);
var
function WordContainsNumber(const AWord: string): boolean;
var
i: integer;
begin
for i:=1 to Length(AWord) do
if CharInSet(AWord[i], ['0'..'9']) then
Exit(true);
Exit(false);
end;
function GetFirstWordThatContainsANumber(const AWords: TArray): string;
var
CurrentWord: string;
begin
Result := '';
for CurrentWord in AWords do
if WordContainsNumber(CurrentWord) then
Exit(CurrentWord);
end;
procedure TForm1.Button4Click(Sender: TObject);
var
SourceString : String;
strArray : TArray;
i : Integer;
begin
SourceString := 'Saint Steven St 6.A II.f 9';
strArray := SourceString.Split([' ']);
for i := 0 to Length(strArray)-1 do
showmessage(strArray[i]);
ShowMessage('The first word containing a number is ' + GetFirstWordThatContainsANumber(strArray));
end;