title: Delimiter with Java line of Input
body: <p>Hopefully this is very simple for someone, but I can't seem to work it out.</p>
  
  <p>Trying to use an input of:</p>
  
  <pre><code>addperson jsmith,john,smith
  </code></pre>
  
  <p>So far I have used two <code>Scanner</code> objects with different delimiters, but I can't get it to work.<br>
  I don't want to scan whole line and split string.</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.ArrayList;
  public class Delim
  {
      public static void main(String[] args)
      {
          ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
          Scanner input = new Scanner(System.in);
          Scanner inputCommand = new Scanner(System.in);
          input.useDelimiter(",");
          inputCommand.useDelimiter(" ");
          System.out.println("Enter a username: (format username,name, surname)");
          list.add(inputCommand.next());               
          list.add(input.next());
          list.add(input.next());
          list.add(input.next());
          System.out.println("//debug: command " + list.get(0));
          printName(list);
  
  
      }
  
      static void printName(ArrayList arr)
      {
          System.out.println("username: " + arr.get(1) + "\nname: " + arr.get(2) + "\nsurname: " + arr.get(3));
      }
  }
  </code></pre>