String Utils

toSentence

Signature: toSentence(str: string)

Convert a string to a sentence.

Examples:

Expression
toSentence("this is a sentence")
Output
This is a sentence
Expression
toSentence("test")
Output
Test

toTitle

Signature: toTitle(str: string)

Convert a string to a title.

Examples:

Expression
toTitle("this is a title")
Output
This Is  A Title
Expression
toTitle("test")
Output
Test

formatDate

Signature: formatDate(dateStr: string, format: string)

Generate a formatted date string. Check out date-and-time to see the supported format string.

Examples:

Expression
// publishedAt = "2022-01-01T00:00:00Z"formatDate(publishedAt, "YYYY-MM-DD")
Output
2022-01-01