Ok i have a string where i want to remove the last word split by \
string name ="kak\kdk\dd\ddew\cxz\"
How do you get this string in the first place? I assume you know that '\' is the escape character in C#. However, you should get far by using
name = name.TrimEnd('\\') name = name.Remove(name.LastIndexOf('\\') + 1);