title: homework parsing strings: removing comma from string (java zybooks)
body: <p>I am trying to get the strings to separate, and WITHOUT the comma.
  We haven't learned anything like arrays, this is an intro class.
  Everything I find on here just keeps giving me errors or does nothing to my code in zybooks.</p>
  
  <pre><code>import java.util.Scanner;
  public class ParseStrings {
      public static void main(String[] args) {
  
  
  
      Scanner scnr = new Scanner(System.in); // Input stream for standard input
      Scanner inSS = null;                   // Input string stream
      String lineString = "";                // Holds line of text
      String firstWord = "";                 // First name
      String secondWord = "";                // Last name
      boolean inputDone = false;             // Flag to indicate next iteration
  
  
      // Prompt user for input
      System.out.println("Enter input string: ");
  
  
      // Grab data as long as "Exit" is not entered
      while (!inputDone) {
  
  
          // Entire line into lineString
          lineString = scnr.nextLine();
  
  
          inSS = new Scanner(lineString);
  
  
          firstWord = inSS.next();
  
          lineString.split(",");
  
          // Output parsed values
          if (firstWord.equals("q")) {
              System.out.println("Enter input string: ");
  
              inputDone = true;
          }
              //This may be where I am messing up??
          else if (lineString.contains(",")) { 
  
              secondWord = inSS.next();
  
  
              System.out.println("First word: " + firstWord);
              System.out.println("Second word: " + secondWord);
  
              System.out.println();
  
  
          } else {
  
              System.out.println("Error: No comma in string");
              System.out.println("Enter input string: ");
  
          }
      }
  
  
      return;
      }
  }
  </code></pre>
  
  <p>I am messing up somewhere and keep getting different error codes as I keep messing with it...</p>
  
  <blockquote>
    <p>"Enter input string: <br>
    First word: Jill, <br>
    Second word: Allen" <br></p>
  </blockquote>
  
  <p>When it should be </p>
  
  <blockquote>
    <p>"Enter input string: <br>
    First word: Jill <br>
    Second word: Allen"<br></p>
  </blockquote>
  
  <p>And then also as the computer enters more data I start getting this message: <br> </p>
  
  <blockquote>
    <p>"Exception in thread "main" java.util.NoSuchElementException"<br>
    at java.util.Scanner.throwFor(Scanner.java:862) <br>
    at java.util.Scanner.next(Scanner.java:1371) <br>
    at ParseStrings.main(ParseStrings.java:44)"<br></p>
  </blockquote>