this slowpoke moves

Search URL Links and List it

procedure TForm1.Button1Click(Sender: TObject);
var
  i, p: Integer;
  s: string;
begin
  ListBox1.Clear;
  for i := 0 to Memo1.Lines.Count - 1 do
  begin
    if Pos('https://', Memo1.Lines.Strings[i]) > 0 then
    begin
      s := '';
      {If the current line contains a "https://", read on until a space is found

      for p := Pos('https://', Memo1.Lines.Strings[i]) to
        Length(Memo1.Lines.Strings[i]) do
        if Memo1.Lines.Strings[i][p] <> ' ' then
          s := s + Memo1.Lines.Strings[i][p]
      else
        break;

       {Remove some characters if address doesnt end with a space}

      while Pos(s[Length(s)], '..;!")]}?''>') > 0 do
        Delete(s, Length(s), 1);
      // Add the Address to the list...
      ListBox1.Items.Add(s);
    end;
  end;

  // Show the number of Addresses in Label1

  if ListBox1.Items.Count > 0 then
    label1.Caption := IntToStr(ListBox1.Items.Count) +
      ' Adresse(n) gefunden.'
  else
    label1.Caption := 'Keine Adresse gefunden.';
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate