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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

770 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