GetSearchFromURL(this_url)
Last updated February 22, 2002
Version: 1 | Requires: CF5 | Library: StrLib
Description:
Returns the search part from the supplied URL. If no search part is found, then returns an empty string. Works with any protocol that follows the "?searchpart" syntax, most notably HTTP.
Return Values:
Returns a string.
Example:
<cfoutput>
#GetSearchFromURL("http://somehost.com/dir1/dir2/filename.htm?q=perl+regular+expression")#<br>
#GetSearchFromURL("filename.htm?action=detail&ID=8191")#<br>
#GetSearchFromURL("?action=detail&ID=8191")#<br>
</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
this_url | URL to parse. | Yes |
Full UDF Source:
/**
* Returns the search part from a specified URL.
*
* @param this_url URL to parse.
* @return Returns a string.
* @author Shawn Seley (shawnse@aol.com)
* @version 1, February 21, 2002
*/
function GetSearchFromURL(this_url) {
var re_found_struct = "";
this_url = trim(this_url);
// the search part is simply everything after a "?" character
re_found_struct = REFind("\?.*", this_url, 1, "True");
if (re_found_struct.pos[1] GT 0) {
return Mid(this_url, re_found_struct.pos[1]+1, re_found_struct.len[1]);
} else return "";
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016