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
Test if a string contains a digit by looping of the string and checking each character. For instance:
function ContainsDigit(const S: string): Boolean;
var
C: Char;
begin
for C in S do
if (C >= '0') and (C <= '9') then
exit(True);
exit(False);
end;
Or you might prefer to write the if statement using the record helper methods from the System.Character
unit.
uses
System.Character;
....
function ContainsDigit(const S: string): Boolean;
var
C: Char;
begin
for C in S do
if C.IsDigit then
exit(True);
exit(False);
end;