Advertisement
tungSfer

Untitled

Mar 28th, 2022
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. public static boolean nameExisted(User user, String path) throws FileNotFoundException, IOException {
  2.         String name = user.getName();
  3.         String pass = user.getPass();
  4.         BufferedReader in = new BufferedReader(new FileReader(path));
  5.         String line = in.readLine();
  6.         while (line != null) {
  7.             String[] te = line.split(" ");
  8.             if (te[0].equals(name) && te[1].equals(pass)) {
  9.                 return true;
  10.             }
  11.             line = in.readLine();
  12.         }
  13.         return false;
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement