在字符串数组中搜索字符串

    技术2022-05-20  35

    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; } System.Console.WriteLine("String number: {0}/nString index: {1}",strNumber, strIndex);


    最新回复(0)