How do i get array index that contains spesific string

Why do I keep getting -1 as Array index?
Here is my code

    public string[] data;
    		
    foreach (string x in data) {
    int index = System.Array.IndexOf (data, x.Contains ("Verant-" + this.transform.parent.name));
    Debug.Log (index.ToString ());
    }

You might see clearer what is happening if you wrote each method call on separate row.

bool doesXContainString = x.Contains ("Verant-" + this.transform.parent.name);
int index = System.Array.IndexOf (data, doesXContainString);

All i did there is take the x.Contains() call out of the parenthesis and wrote it open.

I guess you wanted to search for any index where the string contains “Verant-” +name. Instead you search for a boolean in the array of strings.

The way to do this would be (for example)

public string[] data;

int index = 0;
for (; index < data.Length; index++) {
     if (data[index].Contains ("Verant-" + this.transform.parent.name))
     {
         break;
     }
 }
Debug.Log (index.ToString ());