string path = "C://hello//world";
int pos = path.LastIndexOf("https://stackoverflow.com/") + 1;
Console.WriteLine(path.Substring(pos, path.Length - pos)); // prints "world"
The LastIndexOf
method performs the same as IndexOf
.. but from the end of the string.