I have a problem where I need to replace the last occurrence of a word in a string.
Situation: I am given a string which is in this format:
You can use a Path class from System.IO namepace:
Path
System.IO
string filePath = "F:/jan11/MFrame/Templates/feb11"; Console.WriteLine(System.IO.Path.GetDirectoryName(filePath));