Capitalize strings using titlecase
This function capitalizes each word in a string, or in a cell array of strings, excepting a user-definable set of short words. The default non-capitalized words are 'a', 'an', 'and', 'or', 'the', and 'in'.
Example:
>> C={'a walk in the park' 'two birds with one stone' 'pay the piper'}';
>> capitalize(C)
ans =
'A Walk in the Park'
'Two Birds With One Stone'
'Pay the Piper'
>> capitalize(C,{'with','THE'})
ans =
'A Walk In the Park'
'Two Birds with One Stone'
'Pay the Piper'
>>
Cite As
Brandon Kuczenski (2024). Capitalize strings using titlecase (https://www.mathworks.com/matlabcentral/fileexchange/43399-capitalize-strings-using-titlecase), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.