title: Check if txt file contains specific itemNumber in Java
body: <p>I got a txt file called "store.txt". I need to check every line in the file too see if an item number is equal to an entered item number, and return the name you see to the right in the file. </p>
  
  <p>An example from that file you see here:</p>
  
  <pre><code>item1234, Badesalt
  item123, Salpetersyre
  item12, Clorid
  item1, Kulsyre
  </code></pre>
  
  <p>This is just an example. So far i almost got it, but then again , its not 100 % good enought.</p>
  
  <p>my code so far:</p>
  
  <pre><code>// Search for item name and sends it back.
  String fromFile;
  String ItemName = null;
  while ((fromFile = file.br.readLine()).contains(itemNumber)) {
      System.out.println("loop going");
      String[] parts = fromFile.split(",");
      ItemName = parts[1];
  }
  System.out.println("Itemname are: " + ItemName);
  </code></pre>
  
  <p>So, i have tried it, but it did not work very well. If i enter item number = item1234, my while loop will loop it 2x times and return item1234, Badesalt which is what i want, but i also returns item123, Salpetersyre.</p>
  
  <p>So how do i make it, so i only get item1234, Badesalt back, if itemNumber is = item1234??</p>