Jimmu John Jimmu John - 1 year ago 53
Vb.net Question

How to return a string in between these "\" characters?

I have a string path that is "C:\folder\theStringIWant\anotherfolder"

I want to extract the string "theStringIWant" from that string, how would i do that?

Answer Source


DirectoryInfo d = new DirectoryInfo(@"C:\folder\theStringIWant\anotherfolder");
var whatYouWant = d.Parent;