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;
}

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

Created by Raymond Camden / Design by Justin Johnson