On Jun 7, 2:08 pm, Martin Honnen <mahotr...@yahoo.dewrote:
_nabuchodonozor wrote:
I have string as path\track.mp3 eg "C:\Mp3\Korn\korn - trash.mp3" and
I want to have only korn - trash.mp3 file without path. How should I
do it?
string s = @"C:\Mp3\Korn\korn - trash.mp3";
Console.WriteLine(Regex.Match(s, @"[^\\]+$").Value);
That certainly copes with the example given - but it won't cope with
the perfectly valid path "C:/Mp3/Korn/korn - trash.mp3".
Given that .NET provides a class specifically for this purpose (Path)
I think it makes sense to use it :)
Jon