finding lower case letters

If I set x='sTring'
is there any possible way that I can detect the position of the upper case letter and add a number 'n' to it so that it'll change to letter to something else? thank you.

Respuestas (1)

Daniel Shub
Daniel Shub el 9 de Nov. de 2011

0 votos

x = 'aStringWithCamelCaseThatHasSomeCapitalLetters';
y = x;
z = x;
y(ismember(x, 'A':'Z')) = '?'
or
z(ismember(x, 'A':'Z')) = x(ismember(x, 'A':'Z'))+1

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 9 de Nov. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by