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?
Request for a new library routine RemoveURLPart()
Request for a new library routine RemoveURLPart()
Anthony Jordan
Re: Request for a new library routine RemoveURLPart()
Would be easy enough to make using existing functions. I don't see the wide appeal for having it as a base function.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Request for a new library routine RemoveURLPart()
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.
If it sounds simple, you have not grasped the complexity.
Re: Request for a new library routine RemoveURLPart()
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:
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: Select all
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
Re: Request for a new library routine RemoveURLPart()
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?
Re: Request for a new library routine RemoveURLPart()
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.
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.