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