This example calls the IndexOf method on an array of strings to report the string number and index of the first occurrence of a substring. using C#
Example
string[] strArray = {"ABCDEFG", "HIJKLMNOP"};
string findThisString = "JKL";
int strNumber;
int strIndex = 0;
for (strNumber = 0; strNumber < strArray.Length; strNumber++)
{
strIndex = strArray[strNumber].IndexOf(findThisString);
if (strIndex >= 0)
break;
}
Console.WriteLine("String number: {0}\nString index: {1}",
strNumber, strIndex);
Compiling the Code
Copy the code and paste it into the Main method of a console application.
Note: here i am using Indexof method, please check this as a reference i will update the code C language as soon as possible