celticMcCaps(lastName)
Last updated May 20, 2003
Version: 1 | Requires: ColdFusion 5 | Library: StrLib
Description:
You can use this function whenever you output an undetermined list of last names in order to be sure that the McNamaras and the MacGreggors names are output correctly.
Return Values:
Returns a string.
Example:
<cfoutput>
#celticMcCaps(last_name)#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| lastName | String to modify. | Yes |
Full UDF Source:
<cfscript>
/**
* Proper capitalization for us Mc's and Mac's!
*
* @param lastName String to modify. (Required)
* @return Returns a string.
* @author Kyle McNamara (kyle@themacs.info)
* @version 1, May 20, 2003
*/
function celticMcCaps(lastName) {
var capLastName = lCase(lastName);
if (left(lastName,2) eq "Mc") {
capLastName = uCase(left(lastName,1)) & lCase(mid(lastName,2,1)) & uCase(mid(lastName,3,1)) & lCase(right(lastName,len(lastName)-3));
return capLastName;
}
else if (left(lastName,3) eq "Mac") {
capLastName = uCase(left(lastName,1)) & lCase(mid(lastName,2,1)) & lCase(mid(lastName,3,1)) & uCase(mid(lastName,4,1)) & lCase(right(lastName,len(lastName)-4));
return capLastName;
}
else return lastName;
}
</cfscript>
Search CFLib.org
Latest Additions
Shawn Porter added
DeMoronize
2 hour(s) ago
Chris Carey added
readPropertiesFi...
1 day(s) ago
Randy Johnson added
lastDayofWeek
3 day(s) ago
Frank Marion added
sitemapPing
7 day(s) ago
Top Rated
QuickSort
Rated 5.0, 3 time(s)
indentXml
Rated 5.0, 3 time(s)
queryColumnsToSt...
Rated 5.0, 3 time(s)
generateSsccAsn
Rated 5.0, 3 time(s)