String
capitalize

🔝 Converts the first character of a string to upper case and the remaining to lower case.

Syntax

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

Parameters

  • str: The string to capitalize.

Returns

The capitalized string.

Examples

capitalize('abc') //=> 'Abc'
 
capitalize('FOO') //=> 'Foo'
 
capitalize('the quick brown fox') //=> 'The quick brown fox'
 
capitalize('1apple') //=> '1apple'

Related

Try