title: How to extract ONLY words from a txt file in Java
body: <p>So I have to extract data from a text file.</p>
  
  <p>The text file is set up like this.</p>
  
  <pre><code>3400      Moderate
  310       Light
  etc.
  </code></pre>
  
  <p>I need to extract the numbers, store them in one array, and the strings, and store them in another array so I can do calculations to the numbers based on whats written in the array, and then output that to a file. I've got the last part down, I just cant figure out how to separate the ints from the strings when I extract the data from the txt. file.</p>
  
  <p>Here is what I have now, but it's just extracting the int and the word as a <code>String</code>.</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  
  public class HorseFeed {
  public static void main(String[] args){
  
      Scanner sc = null;
      try {
          sc = new Scanner(new File("C:\\Users\\Patric\\Desktop\\HorseWork.txt"));
      } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      List&lt;String&gt; lines = new ArrayList&lt;String&gt;();
      while (sc.hasNextLine()) {
        lines.add(sc.nextLine());
      }
  
      String[] arr = lines.toArray(new String[0]);
  
      for(int i = 0; i&lt; 100; i++){
          System.out.print(arr[i]);
      }
  
  }
  
  }
  </code></pre>