Skip to content

Latest commit

 

History

History
38 lines (22 loc) · 735 Bytes

File metadata and controls

38 lines (22 loc) · 735 Bytes

ts-humanize v1.0.0


ts-humanize / capitalizeWord

Function: capitalizeWord()

capitalizeWord(str): string

Defined in: formatting/strings.ts:40

Capitalizes the first character of a string, preserving any leading whitespace. If the string starts with whitespace, capitalizes the first non-whitespace character after each whitespace.

Parameters

str

string

The string to capitalize.

Returns

string

The capitalized string.

Examples

capitalizeWord("hello world"); // "Hello world"
capitalizeWord("  hello"); // "  Hello"