Skip to content

Latest commit

 

History

History
46 lines (26 loc) · 990 Bytes

File metadata and controls

46 lines (26 loc) · 990 Bytes

ts-humanize v1.0.0


ts-humanize / capitalizeSentence

Function: capitalizeSentence()

capitalizeSentence(sentence, capitalizeAllWords?): string

Defined in: formatting/strings.ts:77

Capitalizes the first character of a sentence, or the first character after each whitespace if capitalizeAllWords is true. Preserves all original whitespace and does not normalize letter casing except for capitalization.

See formatSentence to trim and clean whitespace.

Parameters

sentence

string

The sentence to capitalize.

capitalizeAllWords?

boolean = false

Whether to capitalize every word in the sentence.

Returns

string

The capitalized sentence.

Examples

capitalizeSentence("hello world"); // "Hello world"
capitalizeSentence("hello   world", true); // "Hello   World"