Operator Scope of Action:
Operator First Added:
Operator Last Altered:
Returns the referenced string, transforming the initial letter of each word to a capital letter and leaving all other characters unchanged.
The function can be chained both to string data and to string literals:
"my new title".capitalize()
The latter gives "My New Title".
The trailing parentheses may be omitted:
If 'title case' is required from a mixed case string, chain with .lowercase():
$MyString = "my nEW title".lowercase.capitalize;
sets $MyString to "My New Title".
Bear in mind the latter will not deal with all capital acronyms (UPS, UNHCR) or CamelCase words (AstroTurf, FedEx).
Functionally equivalent to capitalize().
The .capitalize() method may also be used on Lists or Sets. Consider "Ant;BEE;Cow":
$MyList = $MyList.capitalize;
… giving "Ant;Bee;Cow".