Java Switch Statement - Is “or”/“and” possible?

前端 未结 5 1795
说谎
说谎 2020-12-14 05:24

I implemented a font system that finds out which letter to use via char switch statements. There are only capital letters in my font image. I need to make it so that, for ex

5条回答
  •  天涯浪人
    2020-12-14 06:08

    From what I understand about your question, before passing the character into the switch statement, you can convert it to lowercase. So you don't have to worry about upper cases because they are automatically converted to lower case. For that you need to use the below function:

    Character.toLowerCase(c);
    

提交回复
热议问题