CFLib.org – Common Function Library Project

acronym(sTerms)

Last updated May 20, 2005
Download UDF

author

Jordan Clark                                      Jordan Clark

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

 
Rated 1 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:

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

Parameters:

Name Description Required
sTerms String to modify. Yes

Full UDF Source:

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

Search CFLib.org


Latest Additions

Ryan Thompson-Jewell Ryan Thompson-Jewell added
ListSplit
1 day(s) ago

Nathan Dintenfass Nathan Dintenfass added
RowsToColumns
1 day(s) ago

Barney Boisvert Barney Boisvert added
indentXml
1 day(s) ago

Barney Boisvert Barney Boisvert added
REReplaceCallbac...
1 day(s) ago

Top Rated

Rob Brooks-Bilson                                 FolderSize
Rated 5.0, 7 time(s)

Nick Giovanni                                     UniqueValueList
Rated 5.0, 5 time(s)

James Sleeman                                     QuickSort
Rated 5.0, 3 time(s)

Jeff Howden ListDeleteDuplic...
Rated 5.0, 3 time(s)

Created by Raymond Camden / Design by Justin Johnson