Capitalize strings using titlecase

Capitalize the first letter of each word in a string or cell array of strings

Vous suivez désormais cette soumission

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'

>>

Citation pour cette source

Brandon Kuczenski (2026). Capitalize strings using titlecase (https://fr.mathworks.com/matlabcentral/fileexchange/43399-capitalize-strings-using-titlecase), MATLAB Central File Exchange. Extrait(e) le .

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.1.0.0

Corrected silly error that caused the function to fail for single-word inputs.

1.0.0.0