Last active
January 20, 2021 23:41
-
-
Save h4r7w3l1/8f5ded5eae4e643c59d2dbbcf91ab468 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string hreflink = "http://dpomain.com/path/somefile.txt"; | |
//string hreflink = "http://cdn.p30download.com/.Mozilla.Firefox.v58.0.x86_p30download.com.zip"; | |
Console.WriteLine("link: "+ hreflink); | |
Uri uri = new Uri(hreflink); | |
Console.WriteLine("uri: "+ uri); | |
string filename = System.IO.Path.GetFileName(uri.LocalPath); | |
Console.WriteLine("GetFileName: "+ filename); | |
Console.WriteLine("GetFullPath: "+ System.IO.Path.GetFullPath(uri.LocalPath)); | |
Console.WriteLine("============= "); | |
var uri2 = new Uri(hreflink); | |
var filename2 = uri.Segments.Last(); | |
Console.WriteLine("path2: "+ filename2); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment