CFLib.org – Common Function Library Project

acronym(sTerms)

Last updated May 20, 2005

Version: 1 | Requires: ColdFusion 5 | Library: StrLib

 
Rated 2 time(s). Average Rating: 5.0

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 it's full meaning. I often see acronyms used in Blogs.

Return Values:
Returns a string.

Example:

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

Parameters:

Name Description Required
sTerms String to modify. Yes

Full UDF Source:

view plain print about
<cfscript>
/**
 * Pass in a set of words to only display it's acronym.
 * 
 * @param sTerms      String to modify. (Required)
 * @return Returns a string. 
 * @author Jordan Clark (JordanClark@Telus.net) 
 * @version 1, May 20, 2005 
 */

function acronym(sTerms) {
    return '
<acronym title="' & sTerms & '">' & trim( reReplaceNoCase( " " & sTerms & " ", "(\w)\w+\s", "\1", "all" ) ) & '</acronym>';
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
3 day(s) ago

Will Belden Will Belden added
longTime
9 day(s) ago

James Sleeman James Sleeman added
quickSort
19 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
22 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 13 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson