C# Remove URL from String -
this seems easy 1 try doesn't seem work
say have following string:
string mystring = "http://www.mysite.com/folder/file.jpg";
how can process remove url , leave "file.jpg" string value?
thanks!
kris
you can use system.io.path
methods
string mystring = "http://www.mysite.com/folder/file.jpg"; string filename = path.getfilename(mystring); // file.jpg
if want process more complex uris can pass thought system.uri
type , grab absolutepath
string mystring = "http://www.mysite.com/folder/file.jpg?test=1"; uri uri = new uri(mystring); string file = path.getfilename(uri.absolutepath);
Comments
Post a Comment