title: How to make array case insensitive
body: <p>I am writing a method that takes a string and searches through all the names for any that contain a matching substring, but how to I make the</p>
  
  <pre><code>targetSubstring 
  </code></pre>
  
  <p>which is the name the user has entered into a JTextField and the </p>
  
  <pre><code>namesArray[I].getname()
  </code></pre>
  
  <p>which is the data from the input file that has been stored in an array, not case-sensitive? So when the user types in for example Sam, I want it to be able to find Sammy and Isamer(since this contains sam inside the name). However, for this to happen I need Sam to not be case-sensitive. So how would I do this? I have tried the .toLowerCase because I thought that would work, but I get different compiler errors. So am I just to using the .toLowerCase right? Here is the last thing I've tried with the .toLowerCase, but it doesn't work. </p>
  
  <pre><code>   if (namesArray[i].getName().toLowerCase.contains(targetSubstring.toLowerCase))
  </code></pre>
  
  <p>Here is the method...</p>
  
  <pre><code>  private void match(String targetSubstring)
    {
      displayArea.setText("");
      displayArea.append("FIND RESULTS for: " + targetSubstring);
      displayArea.append("\n");
      displayArea.append("\n Name               Best Decade");
      displayArea.append("\n---------------     ---------------");
      for (int i = 0; i &lt; namesArray.length; i++) {
        if (namesArray[i].getName().contains(targetSubstring))
        {
          displayArea.append("\n" + namesArray[i].getName() + "      " +
                          namesArray[i].bestDecade());
        }
       }
    }
  </code></pre>