CFLib.org – Common Function Library Project

stripFont(str)

Last updated January 10, 2006

author

Dave Shuck

Version: 1 | Requires: CF5 | Library: StrLib

Description:
This tag removes all font tags from a string argument using regular expression comparison to catch open font tag regardless of the attributes.

Return Values:
Returns a string.

Example:

<cfset dirtyString = "<font size=""5"" color=""pink"">Here is content a user entered on your site!!!</font>" />

<cfset cleanString = stripfont(dirtyString) />

Parameters:

Name Description Required
str String to format. Yes

Full UDF Source:

/**
 * This tag removes all font tags from a string.
 * 
 * @param str 	 String to format. (Required)
 * @return Returns a string. 
 * @author Dave Shuck (dshuck@gmail.com) 
 * @version 1, January 10, 2006 
 */
function stripFont(str) {
	//remove the open font tag
	var returnStr = reReplaceNoCase(str,"(<font)[^>]*>","","all");
	//remove the close font tag
	returnStr = replaceNoCase(returnStr,"</font>","","all");
	//return the stripped string
	return returnStr;
}
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