Transforms the first letter of a string to uppercase or the first letter of each word, and optionally lowercase uppercase characters.
ucFirst(string [, doAll] [, doLowerIfAllUppercase])
→ returns string
string.ucFirst([doAll] [, doLowerIfAllUppercase])
Lucee 4.5+ Capitalizes the first character of the first word only.
ucFirst("hello world!")
Expected Result: Hello world!
Lucee 4.5+ Using the optional doAll parameter capitalizes the first character of all words. Word separators are: whitespace, period, parenthesis, or dash.
ucFirst("cfdocs.org is your (everyone's) resource for cf-related documentation!", true)
Expected Result: Cfdocs.Org Is Your (Everyone's) Resource For Cf-Related Documentation!
Lucee 4.5+ Using the optional doLowerIfAllUppercase parameter allows for intelligent capitalization of words in all caps.
ucFirst("CFDOCS.ORG YOUR (EVERYONE'S) RESOURCE FOR CF-RELATED DOCUMENTATION!", true, true)
Expected Result: Cfdocs.Org Your (Everyone's) Resource For Cf-Related Documentation!
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.