CFLib.org – Common Function Library Project

acronym(sTerms)

Last updated July 18, 2013

author

Jordan Clark

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Takes a full string of words as input then converts it for proper display in the html <acronym> tag. That way you see the acronym but in most browsers you can put your mouse over the acronym to display its full meaning. I often see acronyms used in Blogs.

Return Values:
Returns a string.

Example:

<cfoutput>I love #acronym( "Hyper Text Markup Language" )#.</cfoutput>

Parameters:

Name Description Required
sTerms String to modify. Yes

Full UDF Source:

/**
 * Pass in a set of words to only display its acronym.
 * 
 * @param sTerms      String to modify. (Required)
 * @return Returns a string. 
 * @author Jordan Clark (JordanClark@Telus.net) 
 * @version 1, July 18, 2013 
 */
function acronym(sTerms) {
    return '<acronym title="' & sTerms & '">' & trim( reReplaceNoCase( " " & sTerms & " ", "(\w)\w+\s", "\1", "all" ) ) & '</acronym>';
}

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