Skip to main content

Function: capitalizeFirstLetter()

capitalizeFirstLetter(str: string): string

Defined in: capitalizeFirstLetter.ts:14

Transforms the first letter to a capital then adds all the rest after it

This differs from toTitleCase in that it doesn't force lowercase on the rest of the string.

Parameters​

ParameterTypeDescription
strstringText to transform

Returns​

string

The input str as Str

Example​

capitalizeFirstLetter('hello world') // 'Hello world'