Skip to content

titleCase

Converts a string to title case (each word capitalized).

titleCase

Signature

typescript
function titleCase(str: string): string

Parameters

  • str - The string to convert

Returns

String in title case format.

Examples

typescript
import { titleCase } from 'strio'

titleCase('hello world')
// "Hello World"

titleCase('the lord of the rings')
// "The Lord Of The Rings"

See Also

Released under the MIT License.