The function to_titlecase
can be used to transform the casing of a string.
Syntax
string to_titlecase(string $input, string &culture)
Formats a $string into title case. The first letter of every word is made uppercase and the remaining characters are set to lowercase. The function also expects a given culture for the chosen writing system.
Parameters
$input: The string to transform casing.
&culture: A string defining the culture of the $input. Should follow language culture name, based on ISO-639-1 (ie. ‘en-US‘, ‘es-ES‘).
Example
{
"a": "change casing to title"
}
{
NewString: to_titlecase(a, 'en-US')
}
{
"NewString": "Change Casing To Title"
}
In this example, the casing of the string is changed to title case.