How can i write a MATLAB function named dedbi that takes input xtx as string and returns another string xtxx as output.

后端 未结 5 816
遇见更好的自我
遇见更好的自我 2021-01-22 09:38

dedbi reverse the words that is, ‘a’ will be replaced by ‘z’, ‘b’ will be replaced by ‘y’, ‘c’ will be replaced by ‘x’ and so on. dedbi will do the same for capital letter t

5条回答
  •  时光取名叫无心
    2021-01-22 10:35

    Another solution:

    function xtx = dedbi(xtx)
        xtx(xtx >= 'a' & xtx <= 'z') = 219 - xtx(xtx >= 'a' & xtx <= 'z');
        xtx(xtx >= 'A' & xtx <= 'Z') = 155 - xtx(xtx >= 'A' & xtx <= 'Z');
    end
    

提交回复
热议问题