Advertisement
umar_ahmad

checkInput.java

Feb 28th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. package chess;
  2.  
  3.  
  4. public class CheckInput {
  5.  
  6. public static boolean checkCoordinateValidity(String in){
  7. if ((in.startsWith("1") || in.startsWith("2") || in.startsWith("3") || in.startsWith("4")
  8. || in.startsWith("5") || in.startsWith("6") || in.startsWith("7") || in.startsWith("8")) &&
  9. (in.endsWith("a") || in.endsWith("b") || in.endsWith("c") || in.endsWith("d")
  10. || in.endsWith("e") || in.endsWith("f") || in.endsWith("g") || in.endsWith("h"))
  11. && (in.length() == 2)) {
  12. return true;
  13. }
  14. else {
  15. return false;
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement