title: Checking strings in an array in Java
body: <p>I was wondering what I am doing wrong. I have a table loaded into a 1d array, with each element being a row, and the values are tab delimited.</p>
  
  <p>For example (instead of \t, it is actually the whitespace tab):</p>
  
  <pre><code>array[0] = "##Misc data 1";
  array[1] = "##Misc data 2";
  array[3] = "#Field1\tField2\tField3";
  array[4] = "LOW\tABC\tDEF"
  array[5] = "HIGH\tXYZ\t123"
  </code></pre>
  
  <p>I want the array to be</p>
  
  <pre><code>array[0] = "";
  array[1] = "";
  array[3] = "#Field1\tField2\tField3";
  array[4] = ""
  array[5] = "HIGH\tXYZ\t123"
  </code></pre>
  
  <p>The code I currently have is</p>
  
  <pre><code>    for (int i = 0; i &lt; array.length; i++) {
          if (!array[i].contains("\t") || !array[i].contains("HIGH") || !array[i].contains("#")) {
              array[i] = "";
          }
      }
  </code></pre>
  
  <p>This makes it so that all of the elements in the array are "". I want to know why that is and what I can change to make it so.</p>
  
  <p>EDIT: Thank you for all your comments and suggestions, I have figured it out with your guidance.</p>
  
  <pre><code>for (int i = 0; i &lt; array.length; i++) {
      if (array[i].contains("\t")) {
          if (array[i].contains("HIGH") || array[i].contains("#")) {
              // do nothing
          } else {
              array[i] = "";
          }
      } else {
      array[i] = "";
      }
  }
  </code></pre>