How to compare list item to a gameobject name in C#

Hello,
i’m trying to deactivate gameobject inside my GUI based on their name by comparing a list of element from an external text file to an array of GameObject. It’s working when i’m hard-coding the value of the string but otherwise it’s not working even though the value is good.

i can’t copy paste whole code, but i’ll try to put the related line

GameObject[] myColorSwatch; //i first declare my game object array
String tempcolor = ""; //create a var that will temporarely store TXT file content.

void Start()
{
    myColorSwatch = GameObject.FindGameObjectsWithTag("UI_Colorswatch"); //i populate the array on start
}
void HighlightText() //i create a function that is called on a mouseover even on a GUI button
        colorSourceFile = new FileInfo("./Assets/TXT/" + currentHighlightName + "c.txt"); //I declaire a text file based on button name, the text file contain 3 lines, each containing 9 number that represent a certain color RGB value, first line is 000000000
        readerColor = colorSourceFile.OpenText(); //i read the text in the text file
        tempcolor = readerColor.ReadToEnd();//store all the text in a variable
        templistcolor = tempcolor.Split('

').ToList();//separate each line of text into separate list item
Debug.Log("this is my tempcolor value: " + tempcolor); //return the 3 line of text
Debug.Log("this is my templistcolor value: " + templistcolor[2]);//return the third line of text
readerColor.Close(); //closing the reader
//–//
Debug.Log("this is my templistcolor number " + templistcolor[0]); //return 000000000
string tempcolorname = “Button-”+ templistcolor[0].ToString(); //return Button-000000000
string tempcolornumber = templistcolor[0].ToString(); //return 000000000
string temptestcolor = “Button-”+templistcolor[0]; //return Button-000000000
Debug.Log("this is my tempcolornumber number " + tempcolornumber);//return 000000000
string hardcodename = “000000000”;

        foreach (GameObject _obj in myColorSwatch)
        {
            if (_obj.name != "Button-"+tempcolornumber) //this IF statement only work if I use _obj.name == "Button-"+hardcodename) no other option work. Of course i dont want to hardcode the value...
            {
                Debug.Log("doing the IF");
                _obj.SetActive(false);//i want to turn every game object off but the color that exist in my text file. work when hardcoding the value in the IF statement.
            }

        }

I was able to find the solution and will gladly share it. Apparently, despite the Debug Log not displaying it, the string was still containing the remaining letter so the comparison in the IF statement never happen. This is non-sens. The Debug Log MUST really display everything and I see this as a bug that DEV should look into.

To get the correct behavior I added Substring to truncate my value to the desired (and predictable) lenght of 9 characther representing my RGB value inside the text file. (each line have is own color number, each color is 9 number)

        string tempcolornumber = templistcolor[0].Substring(0,9).ToString();