Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delete www string in delphi

Posted on 2011-03-04
2
Medium Priority
?
397 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 2000 total points
ID: 35036559
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
ID: 35036579
IT works !

Thanks a lot!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Six Sigma Control Plans
Starting up a Project

926 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