how can I change a character string from low case to upper case without using the formula of 'low()' and 'upper()' ?

3 visualizaciones (últimos 30 días)
Hi I´m trying to find the way of doing an algorithm in where I will need to change a character string from low case to upper case or vice versa the thing is that I dont want to to it through the formula that Matlab gives, I´m trying to do it manually without that formula, at this moment this is all the progress I have:
function outString = Revrselow(inString)
outString= '';
for idx=1:length(inString)
outString = [outString inString(idx)];
if double(inString(idx)) >= 97 && double(inString(idx)) <= 122
ret= double(inString(idx)) >= 65 && double(inString(idx)) <= 90;
end
end
end
Thanks in advance.

Respuestas (1)

Walter Roberson
Walter Roberson el 27 de Oct. de 2020
Subtract 32 from the character code. Which you might want to phrase as
variable - 'a' + 'A'

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by