CFLib.org – Common Function Library Project

StripAnchors(str)

Last updated November 1, 2002

author

Brian Brown

Version: 2 | Requires: CF5 | Library: StrLib

Description:
A function that will strip out all anchors in text that has been passed as an argument to the function.

Return Values:
Returns a string.

Example:

<cfsavecontent variable="foo">
This is some text with some <b>html</b> in it as
well as <a href="links.cfm">links with <b>formatting</b></a> in them.
</cfsavecontent>

<cfoutput>#stripAnchors(foo)#</cfoutput>

Parameters:

Name Description Required
str String to strip anchors from. Yes

Full UDF Source:

/**
 * A function that will strip out all anchors in text that has been passed as an argument.
 * Version 2 by Raymond Camden
 * 
 * @param str 	 String to strip anchors from. (Required)
 * @return Returns a string. 
 * @author Brian Brown (vonbrownz@hotmail.com) 
 * @version 2, November 1, 2002 
 */
function stripAnchors(str) {
	var temp = reReplaceNoCase(str,"<[[:space:]]*a[[:space:]]+[^>]*>","","all");
	return reReplaceNoCase(temp,"<[[:space:]]*/a[[:space:]]*>","","all");
}
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