我正在尝试在文本字符串中获取“hello world”的最后一个索引。
string sourceText = "hello world. no yes what where hello world but not right in left hello world end of text";
string searchIndex = "hello world";
int index = sourceText.LastIndexOf(searchIndex);
if (index != -1)
{
Console.Write(index);
}
但它总是返回-1。