I have an application that accepts a variety of serial input ASCII characters as "commands". For example, M,U,u,P,?,D,S. The list makes up much less than half of the ASCII character set (13 at latest count, might go slightly higher).
Each message begins with a '$' as a "framing" character, then one of the characters, above. I would like to test whether or not the received character is one of the 13 valid characters.
A chain of if(), else if(),.. would work but that seems awkward. A switch chain would also work but, again, its just big enough to seem awkward. There are too many to do if(MyChar == 'M")||(MyChar == 'U')|| ...
Unfortunately, the list is quasi-random with little in common between them beyond the fact that they are ASCII characters.
So, is there any way to simplify this process, somehow?