Capitalizes the first letter of each word in a given string and converts the rest of the string to lowercase.
capitalizeAll("bread and butter")// => { ok: true, value: 'Bread And Butter' } Copy
capitalizeAll("bread and butter")// => { ok: true, value: 'Bread And Butter' }
Handling non-string input:
capitalizeAll(42)// => { ok: false, error: Error('[strings.capitalizeAll] Expected string value as input') } Copy
capitalizeAll(42)// => { ok: false, error: Error('[strings.capitalizeAll] Expected string value as input') }
The string to capitalize.
A Result object with either the capitalized string on success, or an Error object if the provided input is not a string.
Result
Error
Generated using TypeDoc v0.24.7
Capitalizes the first letter of each word in a given string and converts the rest of the string to lowercase.
Example
Example
Handling non-string input: