UCFirst
Transform the first letter of a string to uppercase or the first letter of each word, and optionally lowercase uppercase characters.
Method Signature
Arguments
string
string
true
The string to transform.
doAll
boolean
false
Boolean flag indicating whether to transform the first letter of each word.
false
doLowerIfAllUppercase
boolean
false
Boolean flag indicating whether to lowercase uppercase characters.
false
Examples
Basic usage
Capitalizes the first character of the first word only.
Result: Hello world!
Capitalize all the words in string
Using the optional doAll parameter capitalizes the first character of all words. Word separators are: whitespace, period, parenthesis, or dash.
Result: boxlang.ortusbooks.com Is Your (everyone's) Resource For BX-related Documentation!
Handling of strings in all uppercase
Using the optional doLowerIfAllUppercase parameter allows for intelligent capitalization of words in all caps.
Result: boxlang.ortusbooks.com Your (everyone's) Resource For BX-related Documentation!
Additional Examples
Related
Last updated
Was this helpful?