There are a number of requirements to make a function or an expression constexpr, but we can still use that to make switch/case work on strings (or const char *). The switch/case statement itself will still require an integral operand, so we must transform a string into an integral value.
Read moreCan you use switch statements with char Java?
The variable used in a switch statement can only be integers, convertable integers (byte, short, char) , strings and enums. You can have any number of case statements within a switch.
Read more