Solved

url parsing - delphi

Posted on 2011-03-18
4
562 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 36

Accepted Solution

by:
Geert Gruwez earned 500 total points
Comment Utility
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
Comment Utility
ok.thanks.

please help
how can i delimite proxy host and port?

with this code?
0
 
LVL 24

Expert Comment

by:jimyX
Comment Utility
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
Comment Utility
thanks!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
object oriented javascript web form 8 71
array6 challenfge 6 62
countPairs challenge 7 57
VB6 Compile Compatibility Issue 4 23
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now