headline
HEADLINE Convert string to "headline" format (initial capitals on key words).
B = HEADLINE(A) converts the initial letter of all words (except prepositions and conjunctions) in A to capitals. A must be a string. Any letters placed in curly braces "{}" will be left unaltered (i.e., in their original case).
B = HEADLINE, with no inputs, produces the default list of prepositions and conjunctions that are not capitalized. This list can be modified using the following syntax:
B = HEADLINE(...,addList,delList) adds the words in cell array addList to the default list of of words, and deletes the words in cell array delList from the default list of of words. Use empty brackets [] for addList if you wish only to specify delList. (The function does not check whether added words already exist on the list, since this would be unnecessary computation. Words to be deleted must match entries in the default list exactly.)
The default list of prepositions can also be modified simply by editing the M-file. The default list has been extracted from the Wikipedia entry for English Prepositions:
http://en.wikipedia.org/wiki/List_of_English_prepositions
Examples:
A = 'life, don''t talk to me about life.'
y = headline(A)
y =
Life, Don't Talk to Me about Life.
y = headline(A,'don''t')
y =
Life, don't Talk to Me about Life.
y = headline(A,'don''t','about')
y =
Life, don't Talk to Me About Life.
B = '{l}ife, don''t talk to {me} about life.'
y = headline(B)
y =
life, Don't Talk to me about Life.
See also UPPER, LOWER, INITIALCAPS.
Cita come
David Fass (2025). headline (https://it.mathworks.com/matlabcentral/fileexchange/12433-headline), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
- MATLAB > Language Fundamentals > Data Types > Tables >
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.0.0.0 | Bug fix.
|
