It is currently Wed May 22, 2013 12:13 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Request for a new library routine RemoveURLPart()
PostPosted: Sun Apr 08, 2012 5:50 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Jun 09, 2003 10:08 pm
Posts: 635
Location: Nottingham
I have found a need for a function RemoveURLPart() which is simialr to GetURLPart() and can be described thus:

RemoveURLPart()

Syntax
Result$ = URLPart(URL$, Parameter$)

Description
Remove a specific field of the given URL$. This can be a named parameter or another field within the URL.

Examples
URL$ = "purebasic.com:80/index.php3?test=1&ok=2"

Debug RemoveURLPart(URL$, "Test")
gives "purebasic.com:80/index.php3?ok=2"
Debug RemoveURLPart(URL$, #PB_URL_Parameters)
gives "purebasic.com:80/index.php3
Debug RemoveURLPart(URL$, #PB_URL_Port)
gives "purebasic.com/index.php3?test=1&ok=2"
Debug RemoveURLPart(URL$, #PB_URL_Path)
gives "purebasic.com:80"
as the parameters are useless without the path

Could this please be implemented?

_________________
Anthony Jordan


Top
 Profile  
 
 Post subject: Re: Request for a new library routine RemoveURLPart()
PostPosted: Sun Apr 08, 2012 6:41 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 17, 2010 12:00 am
Posts: 974
Location: Anderson Island, WA
Would be easy enough to make using existing functions. I don't see the wide appeal for having it as a base function.


Top
 Profile  
 
 Post subject: Re: Request for a new library routine RemoveURLPart()
PostPosted: Sun Apr 08, 2012 9:13 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2856
Location: Wales, UK
Sorry akj, I tend agree with jassing on this one. I can't see a great demand for this function - but you could persuade otherwise if you can give compelling reasons. It would be more elegant than using a home-grown macro/procedure, but why would we all want it in the first place?

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: Request for a new library routine RemoveURLPart()
PostPosted: Wed Apr 11, 2012 2:12 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Jun 09, 2003 10:08 pm
Posts: 635
Location: Nottingham
Yes, I guess I agree your comments and I withdraw my request, but ...

It would be nice (for me) if SetURLPart() did this when supplied with a null parameter, but instead it returns bad results.
For example:
Code:
URL$ = "http://user:pass@www.purebasic.com:80/index.php3

URL$ = SetURLPart(URL$, #PB_URL_Port, "")

Debug URL$ ; Bad result of http://user:pass@www.purebasic.com:/index.php3 (notice the unwanted colon after .com)

URL$ = SetURLPart(URL$, #PB_URL_Protocol, "")

Debug URL$ ; Bad result of ://user:pass@www.purebasic.com:/index.php3

_________________
Anthony Jordan


Top
 Profile  
 
 Post subject: Re: Request for a new library routine RemoveURLPart()
PostPosted: Wed Apr 11, 2012 3:01 am 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 17, 2010 12:00 am
Posts: 974
Location: Anderson Island, WA
It's easy enough to write your own "removeurlpart" function -- why not go that route instead of trying to force functions to do something else?


Top
 Profile  
 
 Post subject: Re: Request for a new library routine RemoveURLPart()
PostPosted: Wed Apr 11, 2012 4:08 am 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 932
Location: New York
The same arguments could be made for many PB commands, including SetURLPart() itself.

I think this is a perfectly legitimate feature request. Not a high priority, but I would be glad to see it pop up on the "Added" list in a future version.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye