Tra*_*arp 16
您将要在字符串上使用IndexOf函数.这将告诉您正在寻找的单词,字符等的起始字符位置.
这是一个示例控制台应用程序:
static void Main(string[] args)
{
String testing = "text that i am looking for";
Console.Write(testing.IndexOf("looking") + Environment.NewLine);
Console.WriteLine(testing.Substring(testing.IndexOf("looking")));
Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud)
这将输出:
15
寻找