In ruby how do you tell if a string input is in uppercase or lowercase?

后端 未结 3 1459
后悔当初
后悔当初 2021-01-13 06:18

I am trying to write a program that when a single letter is inputted, if it\'s in uppercase, leave it in uppercase and return it, and if it\'s in lowercase, then convert to

3条回答
  •  一整个雨季
    2021-01-13 06:40

    Sounds like you just need to convert to uppercase and don't need to bother with the if lowercase check at all, since applying #upcase to something that is already uppercase won't effect it.

提交回复
热议问题