to_sentencecase
TABLE OF CONTENTS
Convert a string to sentence case
Definition
string to_sentencecase(string $string)
Converts a string to sentence case, i.e., capitalizes the first words of sentences, and sets the rest to lowercase.
Parameters
string $string
String to convert to sentence case.
Returns
string
$string after converting to sentence case. In the returned string, the starting letter and any letters following a period are capitalized, while the rest are set to lowercase.
Examples
Transformation
{
a: to_sentencecase(`lowercase`),
b: to_sentencecase(`UPPERCASE`),
c: to_sentencecase(`An unusually CASED Sentence. or Two.`),
d: to_sentencecase(`123`),
e: to_sentencecase(`true`),
f: to_sentencecase(`null`)
}Result
{
"a": "Lowercase",
"b": "Uppercase",
"c": "An unusually cased sentence. Or two.",
"d": "123",
"e": null,
"f": null
}Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article