title: How to split a string by tabs and newlines?
body: <p>I got a tab-delimited file that I want to split by tabs and by newlines where a tab represents the delimiter between fields and a newline represents a new object that should be created. The file can look like this:</p>
  
  <p><code>Peter\tpeter@example.com\tpeterpassword\nBob\tbob@bobby.com\tbobbypassword\n...</code></p>
  
  <p>where <code>\t</code> is a tab and <code>\n</code> is a newline.</p>
  
  <p>I want to enable uploading this file to my program that creates a new user for every line in the file with the fields on the line. But how can I use two tokens - both tab and newline? My code would look something like the following:</p>
  
  <pre><code>String everything = "";
  BufferedReader br = null;
  try {
      br = new BufferedReader(new InputStreamReader(file.getInputStream()));
      StringBuilder sb = new StringBuilder();
      String line = br.readLine();
  
      while (line != null) {
  
         //now create object according to the string
         StringTokenizer st = new StringTokenizer(line , "\t");    
         String name = st.nextToken();
         String email = st.nextToken();
         String password = st.nextToken();
         User.createNewUser(name, email, password);
  
          sb.append(line);
          sb.append('\n');
          line = br.readLine();
      }
      everything = sb.toString();
      br.close();
  } catch (IOException e) {
      e.printStackTrace();
  }
  System.out.println("Everything: " + everything);
  </code></pre>
  
  <p>Would code like the above work?</p>