Solved

url parsing - delphi

Posted on 2011-03-18
4
573 Views
Last Modified: 2012-05-11
Hello experts.Please help me.
i have a trouble.

i a memo1.lines are string like this : C:\temp\11.zip|C:\program files......

i have wrote a code that need to parse first dir adress and second
var
localfile,secondfile,total : string;
begin
total := Memo1.Lines[0];
total := localfile + '|' + second;
showmessage(localfile);
showmessage(second);

But this not work.
please help me.
Thanks.
0
Comment
Question by:helyonprime96
  • 2
4 Comments
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 500 total points
ID: 35163702
use a TStringList


var
  Temp: TStrings;
begin
  Temp := TStringList.Create
  try
    Temp.StrictDelimiter := True;
    Temp.Delimiter := '|';
    Temp.DelimitedText := Memo1.Lines[0];
    showmessage(Temp[0]);
    showmessage(Temp[1]); 
  finally
    Temp.Free;
  end;

Open in new window

0
 

Author Comment

by:helyonprime96
ID: 35163707
ok.thanks.

please help
how can i delimite proxy host and port?

with this code?
0
 
LVL 24

Expert Comment

by:jimyX
ID: 35163742
var
  Str:string;
begin
  str:=Memo1.Lines[0]+'|'; // or str:=Memo1.Text+'|';
  while pos('|',Str) > 0 do
    begin
      ShowMessage(copy(str,1,pos('|',Str)-1));
      delete(str,1,pos('|',Str));
    end;
end;

Open in new window

0
 

Author Closing Comment

by:helyonprime96
ID: 35164244
thanks!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question