Capitalizing every word in a string
Mostrar comentarios más antiguos
str='The bottom of the deep blue sea'
strN='The Bottom Of The Deep Blue Sea'
To convert the string 'str' to 'strN' is used:
regexprep(str,'(\<[a-z])','${upper($1)}')
Can someone please xeplain this? Another suggestion which did not work was:
regexprep(str,'(\<\w)','${upper($1)}')
Is there a simpler (it is ok if it is longer) way of doing this?
1 comentario
Stephen23
el 17 de En. de 2019
regexprep(str,'(\w)(\w+)','${upper($1)}$2')
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!