Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extracting File Names...
Message
From
03/01/2005 17:58:26
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00973941
Message ID:
00973957
Views:
19
This message has been marked as the solution to the initial question of the thread.
>If I have a string:
>
> "c:\temp\filename.txt"
>
>Has anyone come up with a way of extracting only "filename.txt" with a one-liner?
>
>I know I can use LastIndexOf and SubString but I was just wondering if there was a one liner with Regex or something...

string filename = System.IO.Path.GetFileName(@"c:\temp\filename.txt");

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform