Advertisement
Guest User

IsEmailInUseMethod

a guest
Apr 25th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. public static boolean isEmailInUse(String aEmail) throws IOException {
  2.  
  3. boolean found = false;
  4. File aFile = new File("users.txt");
  5. if (!aFile.exists())
  6. return false;
  7. else {
  8. Scanner in = new Scanner(aFile);
  9. String fileElements[];
  10. while (in.hasNext()) {
  11. fileElements = (in.nextLine()).split(",");
  12. if ((fileElements[0]).equals(aEmail))
  13. found = true;
  14. JOptionPane.showMessageDialog(null, "Email already in use");
  15. }
  16. }
  17. if (!found)
  18. return true;
  19. else
  20. return false;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement