Delete www string in delphi

Posted on 2011-03-04
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;
  if Pos('www.', URL) > 0 then Delete(Url, 1, 7);
  Result := Copy(Url, 1, Pos('w.', Url) - 1);
  if Result = '' then Result := URL;

Please correct it.
Help me.
Question by:helyonprime96
LVL 24

Accepted Solution

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

Open in new window


Author Closing Comment

ID: 35036579
IT works !

Thanks a lot!

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 77
Arduino EDI - Programming language 3 79
Please explain: Aspect Oriented Programming 2 83
I need an assist with a programming logic math question. 5 55
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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 …

932 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

12 Experts available now in Live!

Get 1:1 Help Now