title: Array.Contains() is always false
body: <p>I've been smashing my head against this problem for days and have tried a tons of different things. I've been all over the forums, tried everything I've seen with no luck. My issue could be that I don't have an override, but I can't figure out how to get that to work.</p>
  <p>I want to check if an array of 5,000+ elements contains a user-entered word. The word gets entered character by character and combined into a string(guessString). And then I use .Contains() to see if that word is in an array.</p>
  <p>***<strong>EDIT please see screenshots for debug logs <a href="https://i.stack.imgur.com/04YQL.png" rel="nofollow noreferrer">WordArray Elements</a> -- <a href="https://i.stack.imgur.com/6y0sk.png" rel="nofollow noreferrer">Debug Output</a> -- <a href="https://i.stack.imgur.com/G8Lgt.png" rel="nofollow noreferrer">Debug With whitespace detection</a> -- <a href="https://i.stack.imgur.com/egNmm.png" rel="nofollow noreferrer">Code that doesnt work</a></strong></p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using TMPro;
  using UnityEngine.EventSystems;
  using UnityEngine.UI;
  using UnityEngine.SceneManagement;
  using System.Linq;
  
  
  public class WordAction : MonoBehaviour
  {
      TMP_Text m_textComponent;
      TMP_Text m_currentSquare;
      public TMP_Text[] squareArray;
  
      List&lt;string&gt; dupKey = new List&lt;string&gt;();
  
      public string[] WordArray;
      public List&lt;string&gt; DictionaryList = new List&lt;string&gt;();
      public TextAsset file;
  
      [SerializeField]
      Color correctColor, wrongColor, maybeColor;
  
      [SerializeField]
      float colorFadeSpeed, colorFadeTime; // 2f, 1f
  
      public float waitTime;
      public string levelID;
      public string key;
      public AudioSource revealSFX;
  
      bool guess;
      string guessString;
      int guessRegulator;
      int guessCount = 1;
      int lessGuessCount; // Starts variable at value of first current row element
      int maxGuessCount;
  
      string[] guessStringArray = new string[1];
  
      void Start()
      {
  
          for (int i = 0; i &lt; 5; i++) // Duplicate key
          {
              dupKey.Add(key[i].ToString());
          }
  
          var content = file.text;
          string[] AllWords = content.Split('\n');
          WordArray = AllWords;
      }
  
  
      public void Magic()
      {
          StartCoroutine(CompareKey());
      }
  
      IEnumerator CompareKey()
      {
          guessRegulator++;
          GuessRegulatorFunction();
  
          lessGuessCount = (guessCount * 5) - 5; // Starts variable at value of first current row element
          maxGuessCount = guessCount * 5;
          guessCount++; // Moves to next row
          int k = 0; // Indexer for key[]
          int cW = 0; // Indexer for CombineWord()
          GameObject keyGO; // Keyboard GO
  
  
          for (int i = lessGuessCount; i &lt; maxGuessCount; i++)
          {
              if (cW &lt; 1)
              {
                  CombineWord(i);
  
                  cW++;
              }
  
              bool match = WordArray.Contains(guessString); // not working
              Debug.Log(match);
              if (match)
              {
                  //do stuff
              }
  
              //compare stuff
              string guessStr = squareArray[i].text.ToString();
              string keyStr = key[k].ToString();
              bool result = guessStr == keyStr;
  
              if (!result &amp;&amp; !dupKey.Contains(guessStr))
              {
                  //wrong stuff
                  GameObject parentGO = squareArray[i].transform.parent.gameObject; // Gets parent of SquareArray element
                  Image parentImage = parentGO.GetComponent&lt;Image&gt;(); // Gets Image component of parent game object         
                  keyGO = GameObject.Find(squareArray[i].text); // Keyboard
                  Image keyParentImage = keyGO.GetComponent&lt;Image&gt;(); // Keyboard
  
                  wrongColor.a = 255;
                  keyParentImage.color = wrongColor;
                  parentImage.color = wrongColor;
                  yield return null;
              }
  
              if (result)
              {
                  //correct stuff
                  dupKey[k] = &quot;&quot;;
  
                  GameObject parentGO = squareArray[i].transform.parent.gameObject; // Gets parent of SquareArray element
                  Image parentImage = parentGO.GetComponent&lt;Image&gt;(); // Gets Image component of parent game object         
                  keyGO = GameObject.Find(squareArray[i].text); // Keyboard
                  Image keyParentImage = keyGO.GetComponent&lt;Image&gt;(); // Keyboard
  
                  correctColor.a = 255;
                  keyParentImage.color = correctColor;
                  parentImage.color = correctColor;
                  yield return null;
              }
  
              if (!result &amp;&amp; dupKey.Contains(guessStr))
              {
                  //yellow stuff
                  for (int x = 0; x &lt; 5; x++) // Duplicate key
                  {
                      if (guessStr == dupKey[x])
                      {
                          dupKey[x] = &quot;&quot;;
                      }
                  }
  
                  GameObject parentGO = squareArray[i].transform.parent.gameObject; // Gets parent of SquareArray element
                  Image parentImage = parentGO.GetComponent&lt;Image&gt;(); // Gets Image component of parent game object         
                  keyGO = GameObject.Find(squareArray[i].text); // Keyboard
                  Image keyParentImage = keyGO.GetComponent&lt;Image&gt;(); // Keyboard
  
                  maybeColor.a = 255;
                  keyParentImage.color = maybeColor;
                  parentImage.color = maybeColor;
                  yield return null;
              }
  
              revealSFX.Play();
              k++;
              yield return new WaitForSeconds(waitTime);
          }
  
          dupKey.Clear();
          for (int i = 0; i &lt; 5; i++) // Duplicate key
          {
              dupKey.Add(key[i].ToString());
          }
  
      }
  
      void GuessRegulatorFunction()
      {
          guessRegulator++; // Stops multiple guess attempts
  
          for (int i = 0; i &lt; (guessCount * 5); i++) // Checks if row is blank when guessing
          {
              if (squareArray[i].text == &quot;&quot;)
              {
                  guess = false;
                  guessRegulator = 0; // Resets guess regulator
                  break;
              }
              else
              {
                  guess = true;
  
              }
          }
  
          if (guessRegulator &gt; 1 || guess == false) // Stops multiple guess attempts
          {
              return;
          }
      }
  
      public void BackSpace()
      {
          for (int i = guessCount * 5; i &gt; (guessCount * 5) - 6; i--)
          {
              if (squareArray[i].text != &quot;&quot;)
              {
                  squareArray[i].text = &quot;&quot;;
                  break;
              }
          }
      }
  
      public void InputLetter()
      {
          guessRegulator = 0;
  
          for (int i = 0; i &lt; guessCount * 5; i++)
          {
              if (squareArray[i].text == &quot;&quot;)
              {
                  squareArray[i].text = EventSystem.current.currentSelectedGameObject.name.ToString();
                  break;
              }
          }
      }
  
      void CombineWord(int i)
      {
          var string1 = squareArray[i].text.ToString();
          var string2 = squareArray[i + 1].text.ToString();
          var string3 = squareArray[i + 2].text.ToString();
          var string4 = squareArray[i + 3].text.ToString();
          var string5 = squareArray[i + 4].text.ToString();
  
          guessString = string1 + string2 + string3 + string4 + string5;
          //Debug.Log(guessString);
      }
  }
  </code></pre>