capitalize

Capitalize the first character of a string and lowercase the remaining characters, returning a tidy single-word display form.

Usage

Converts the first letter of a string to uppercase and the remaining letters to lowercase.

import { capitalize } from '@movk/core'

capitalize('foo bar') // => 'Foo bar'
capitalize('FOO BAR') // => 'Foo bar'

API

capitalize(str: string): string

Parameters

str
string required
The string to convert.

Returns

string
Returns the string with the first letter capitalized.

Changelog

No recent changes
Copyright © 2024 - 2026 YiXuan - MIT License