Solved

Delete www string in delphi

Posted on 2011-03-04
2
380 Views
Last Modified: 2012-05-11
hello experts.
please help me.

i have a list of sites.many sites contains www. in his link
i wrote a procedure that deletes it, but any times it doesnt work correctly.

There is :
function Deletewww(URL : string) : string;
begin
  if Pos('www.', URL) > 0 then Delete(Url, 1, 7);
  Result := Copy(Url, 1, Pos('w.', Url) - 1);
  if Result = '' then Result := URL;
end;

Please correct it.
Help me.
Thanks
0
Comment
Question by:helyonprime96
2 Comments
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
Comment Utility
You can use "StringReplace" function to replace all the 'www.' with blanks:
function Deletewww(URL : string) : string;
begin
  Result := StringReplace(URL,'www.','',[rfReplaceAll, rfIgnoreCase]);
end;

Open in new window

0
 

Author Closing Comment

by:helyonprime96
Comment Utility
IT works !

Thanks a lot!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This is an explanation of a simple data model to help parse a JSON feed
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 …
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…

763 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

13 Experts available now in Live!

Get 1:1 Help Now