Java input Letter
- by xyvyre
I'm doing an java activity that if Name start with letter A-G and Ends with Letter H-z the output is invalid heres my code:
System.out.print("Enter your name: ");
String str = in.readLine();
if(str.startsWith("a" )){
System.out.print("INVALID!");
} if(str.endsWith("h")){
System.out.print("INVALID!");
}
This works but how can i implement letter a to g and h to z
i already try this [a-g] and it not WORK!