finding lower case letters

2 次查看(过去 30 天)
NUR KHAIRUNNISA rahimi
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.

回答(1 个)

Daniel Shub
Daniel Shub 2011-11-9
x = 'aStringWithCamelCaseThatHasSomeCapitalLetters';
y = x;
z = x;
y(ismember(x, 'A':'Z')) = '?'
or
z(ismember(x, 'A':'Z')) = x(ismember(x, 'A':'Z'))+1

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by