Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to decode/encode URL string in Delphi7?

Status
Not open for further replies.

Alexsey

Programmer
Aug 8, 2002
9
UA
Hello to everybody!
Please, help with your knowledges, which component of Delphi 7 can decode/encode URL string (like TNMURL at the Delphi 4)? Thanks before.

PS: Sorry for my poor english :(
 
If you've got the Indy Internet components installed, you can use something like this:

Code:
uses IdURI;

procedure TForm1.Button1Click(Sender: TObject);
begin

  if Edit1.Text = '' then
     raise Exception.create(  'Enter a URL to parse.' )
  else
     with tIdURI.create( Edit1.Text ) do
     try
        Memo1.Lines.Clear;
        Memo1.Lines.Add( 'Protocol: ' + Protocol );
        Memo1.Lines.Add( 'Path:     ' + Path     );
        Memo1.Lines.Add( 'Host:     ' + Host     );
        Memo1.Lines.Add( 'Document: ' + Document );
        Memo1.Lines.Add( 'Port:     ' + Port     );
        Memo1.Lines.Add( 'Bookmark: ' + Bookmark );
     finally
        free;
     end; // with/try

end;

There's an entry in the Help system that documents each of the settings. Also, there's a ParseURI method that returns the results in VAR string parameters.

I'm pretty sure the Indy components are available with certain editions of Delphi 7, though you can also obtain them from
Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top