Get First word that contains numbers

后端 未结 5 737
醉梦人生
醉梦人生 2021-01-22 18:58

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         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-22 19:28

    You can use simething like this to know if a word contains chars '0'..'9'

      function DigitInWord(s: string): boolean;
      var
        ch: char;
      begin
        result := false;
        for ch :='0' to '9' do
          if Pos(s, ch) > 0 then
          begin
            result := true;
            break;
          end;
      end;
    

提交回复
热议问题