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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 214
ASP/VB email question 4 46
shape, triangle, dbctrlgrid 3 17
learn programming 8 43
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 …
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 …

821 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