Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean isEmailInUse(String aEmail) throws IOException {
- boolean found = false;
- File aFile = new File("users.txt");
- if (!aFile.exists())
- return false;
- else {
- Scanner in = new Scanner(aFile);
- String fileElements[];
- while (in.hasNext()) {
- fileElements = (in.nextLine()).split(",");
- if ((fileElements[0]).equals(aEmail))
- found = true;
- JOptionPane.showMessageDialog(null, "Email already in use");
- }
- }
- if (!found)
- return true;
- else
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement