比如,我有这样的一个字符串
String MyFileUrl = "http://www.xx.com/MyFile/123.txt"
String FullName= “文件全名”;//这个如何做?获得的值假设为123.txt
String ExtentName= “扩展名”;//这个又如何做?获得的值伎为txt
在线等待,救命救命!
String MyFileUrl = "http://www.xx.com/MyFile/123.txt"
String FullName= “文件全名”;//这个如何做?获得的值假设为123.txt
String ExtentName= “扩展名”;//这个又如何做?获得的值伎为txt
在线等待,救命救命!
你在程序里试试,我手写的可能有错,
就是个字符处理问题。
你自己改!
String MyFileUrl = "http://www.xx.com/MyFile/123.txt " ;
String FullName=MyFileUrl.Substring(MyFileUrl.LastIndexOf("/")+1,MyFileUrl.Length-MyFileUrl.LastIndexOf("/")-1);
String ExtentName=MyFileUrl.Substring(MyFileUrl.LastIndexOf(".")+1,MyFileUrl.Length-MyFileUrl.LastIndexOf(".")-1);
string TmpName =MyFileUr.Substring(MyFileUr.LastIndexOf("/")+1);
string fileName = TmpName.Substring(0,TmpName.IndexOf("."));
string TxtName = TmpName.Substring(TmpName.IndexOf("."));
String MyFileUrl = "http://www.xx.com/MyFile/123.txt ";
String FullName = System.IO.Path.GetFileName(MyFileUrl);
String ExtentName = System.IO.Path.GetExtension(MyFileUrl).Trim('.');