CFLib.org – Common Function Library Project

StripUrl(URL)

Last updated September 6, 2001

author

Steven Ketterman

Version: 1 | Requires: CF5 | Library: StrLib

Description:
This Function will strip the following: <UL> <LI>http:// <LI>http://www. <LI>www. </UL>

Return Values:
Returns a string.

Example:

<cfoutput>
#StripUrl("http://www.btp.pghsonicweb.com/someonehelp.htm")#
</cfoutput>

Parameters:

Name Description Required
URL URL to strip Yes

Full UDF Source:

/**
 * The function deletes non-needed characters (ie. http://)
 * 
 * @param URL 	 URL to strip 
 * @return Returns a string. 
 * @author Steven Ketterman (beans@pghsonicweb.com) 
 * @version 1, September 6, 2001 
 */
function StripUrl(UrltoStrip)
{
  Var oldurl = UrltoStrip;
  
  if(oldurl CONTAINS 'http://www.'){
  	oldurl = ReplaceNoCase(oldurl, 'http://www.', '');
  }
  if(oldurl CONTAINS 'http://'){
  	oldurl = ReplaceNoCase(oldurl, 'http://', '');
  }
  if(oldurl CONTAINS 'www.'){
  	oldurl = ReplaceNoCase(oldurl, 'www.', '');
  }
  
  oldurl = ListFirst(oldurl, '/');
  Return OldUrl;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson