SpaceCap(text)
Last updated September 20, 2002
Version: 1 | Requires: CF5 | Library: StrLib
Description:
Returns a string with a space before each capital letter unless it is the first letter in the string. Handy if you need output a field name like "FirstName" in the format of "First Name".
Return Values:
Returns a string.
Example:
<CFSET RequiredField="FirstName">
<CFOUTPUT>
The <b>#spacecap(RequiredField)#</b> Field is Required.
</CFOUTPUT>
Parameters:
Name | Description | Required |
---|---|---|
text | String to modify. | Yes |
Full UDF Source:
/**
* Returns a string with a space before each capital letter.
*
* @param text String to modify. (Required)
* @return Returns a string.
* @author Mark W. Breneman (Mark@vividmedia.com)
* @version 1, September 20, 2002
*/
function SpaceCap(text) {
return REReplace(text, "([.^[:upper:]])", " \1","all");
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016