How to split path in c#
I have path of video like as C:\Users\Kalu\Desktop\Emptiness.mp4 . I want to get video name as Emptiness.mp4 in string. So how can i do.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Princy GuptaPosted Jun 11, 2014, 2:50 AM
Hi
you can use the Path class available in System.IO namespace
string filename = Path.GetFileName(@"C:\Users\Kalu\Desktop\Emptiness.mp4");
if you need only filename without the extension use
filename = Path.GetFileNameWithoutExtension(@"C:\Users\Kalu\Desktop\Emptiness.mp4");
Hope it helps
kalu singh raoPosted Jun 11, 2014, 2:54 AM