capitalize

string

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

Signature

capitalize(str: string): string

Parameters

NameTypeDescription
strstringThe string to capitalize

Returns

string - Returns the capitalized string

Examples

Basic Usage

import { capitalize } from 'dashlite'

const result = capitalize('hello')
console.log(result)

Output:

Hello

All Caps

import { capitalize } from 'dashlite'

const result = capitalize('HELLO WORLD')
console.log(result)

Output:

Hello world

Available since version 1.0.0