Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package chess;
- public class CheckInput {
- public static boolean checkCoordinateValidity(String in){
- if ((in.startsWith("1") || in.startsWith("2") || in.startsWith("3") || in.startsWith("4")
- || in.startsWith("5") || in.startsWith("6") || in.startsWith("7") || in.startsWith("8")) &&
- (in.endsWith("a") || in.endsWith("b") || in.endsWith("c") || in.endsWith("d")
- || in.endsWith("e") || in.endsWith("f") || in.endsWith("g") || in.endsWith("h"))
- && (in.length() == 2)) {
- return true;
- }
- else {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement