Is there a simple way to convert a string to title case? E.g. john smith becomes John Smith. I\'m not looking for something complicated like John R
john smith
John Smith
If you can use third party libraries in your code then lodash has a helper function for us.
https://lodash.com/docs/4.17.3#startCase
_.startCase('foo bar'); // => 'Foo Bar' _.startCase('--foo-bar--'); // => 'Foo Bar' _.startCase('fooBar'); // => 'Foo Bar' _.startCase('__FOO_BAR__'); // => 'FOO BAR'