How to check if a string at a certain position contains character a-h?
char, if-statement, java
Solution
Relying on character ordering and that a..h is a consecutive range:
char firstChar = g.charAt(0);
if (firstChar >= 'a' && firstChar <= 'h') {
// ..
}
Problem
I know there must be a simpler way to check, but this is what I'm doing right now. ``` if (g.charAt(0) == 'a' || g.charAt(0) =='b' || g.charAt(0) =='c' || g.charAt(0) == 'd' || g.charAt(0) =='e' || g.charAt(0) =='f' || g.charAt(0) == 'g' || g.charAt(0) =='h') ```