String
titleCase

🖋️ Converts a string to Title Case (opens in a new tab).

Syntax

import { titleCase } from '@opentf/std';
 
titleCase(str: string): string

Parameters

  • str: The string to convert.

Returns

The title-cased string.

Examples

titleCase('hello world') //=> 'Hello World'
 
titleCase('foo-bar') //=> 'Foo Bar'
 
titleCase('the quick brown fox') //=> 'The Quick Brown Fox'
 
titleCase('__FOO_BAR__') //=> 'Foo Bar'

Related

Try