Brian McGarvie | Find out more information on Brian M McGarvie and his IT consultancy, and personal adventures and experiences…

Mar/08

12

Capitalization for us Mc’s and Mac’s!

Needed to capltalize Mc’s and Mac’s? Here’s a quick function for it…


/**
* Proper capitalization for us Mc's and Mac's!
*/
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;
}

Found at http://cflib.org/udf.cfm?ID=896

Bookmark and Share

RSS Feed

No comments yet.

Leave a comment!

«

»

Get Adobe Flash playerPlugin by wpburn.com wordpress themes

Find it!

Tags