String Comparasion Error

Hello, I’m having trouble with checking a user inserted string with an array of strings, my code is pretty self explained. I saw this post when I searched for solutions, but it didn’t really help me.
There is probably some super silly error, but I can’t find it…

Thanks for helping! :smiley:

Btw: I’m using C#

    void inputReg()
    {
        for (int i = 0; i < 100;)
        {
            print(input + " and " + GetComponent<codeScript>().keys[i, 0]); //this prints for example "help and help"
            if (input == GetComponent<codeScript>().keys[i, 0]) //this still doesnt get called though both strings should be the same
            {
                print("works");
            }
            i++;
        }
    }

It’s stupid how I always answer my own questions.

Whatever, seems like you can’t use == in this case.
I used .Equals instead and it works.

Working code if anyone has the same problem… :

    {
        for (int i = 0; i < 100;)
        {
            print(input + " and " + GetComponent<codeScript>().keys[i, 0]); //this prints for example "help and help"
            if (input.Trim().Equals(GetComponent<codeScript>().keys[i, 0]))
            {
                print("works");
            }
            i++;
        }