toCapitalCase
Converts the starting letter of every word into an upper case and will leave the remaining letters as lower case ones.
Import
import { toCapitalCase } from '@fullstacksjs/toolbox';
Signature
function toCapitalCase(str: string): string {}
Examples
toCapitalCase(''); // ''
toCapitalCase(' '); // ''
toCapitalCase('foo'); // 'Foo'
toCapitalCase('foo bar'); // 'Foo Bar'
toCapitalCase('foo-bar'); // 'Foo Bar'
toCapitalCase('fooBar'); // 'Foo Bar'
toCapitalCase('foo_bar'); // 'Foo Bar'
toCapitalCase('foo bar code'); // 'Foo Bar Code'
toCapitalCase('foo-bar-code'); // 'Foo Bar Code'
toCapitalCase('fooBarCode'); // 'Foo Bar Code'
toCapitalCase('foo_bar_code'); // 'Foo Bar Code'
toCapitalCase('FOO_BAR_CODE'); // 'Foo Bar Code'
toCapitalCase('ThisIs-fullstacksjs radio__and--I-loveCoding'); // This Is Fullstacksjs Radio And I Love Coding