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

7 views (last 30 days)
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.

Answers (1)

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

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!