判断字符串,建文件夹.... 字符串类似“test/c66c3ef8/c2623bd2/App_global.asax.hmet2dpt.0.cs”这样的如果字符串最后面没有"/"则建文件夹“test/c66c3ef8/c2623bd2”怎么写代码啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string str = "test/c66c3ef8/c2623bd2/App_global.asax.hmet2dpt.0.cs"; Directory.CreateDirectory(str.Substring(0, str.LastIndexOf("/"))); string str="test/c66c3ef8/c2623bd2/App_global.asax.hmet2dpt.0.cs";if(str.LastIndexOf("/")<0){ if(!Directory.Exists("~/test/c66c3ef8/c2623bd2/")) { Directory.CreateDirectory("~/test/c66c3ef8/c2623bd2/"); }} string urlPath=PrePath+"test/c66c3ef8/c2623bd2/App_global.asax.hmet2dpt.0.cs"; //PrePath为你的路径前缀System.IO.DirectoryInfo diBak = new System.IO.DirectoryInfo(urlPath); if (diBak.Exists) { return strPreXMLPath;} else { if(urlPath.EndWith(@"/")) {diBak.Create();} return diBak.FullName; } 改改:string str= "test/c66c3ef8/c2623bd2/App_global.asax.hmet2dpt.0.cs";if(str.LastIndexOf("/") != str.Length - 1) Directory.CreateDirectory(str.Substring(0, str.LastIndexOf("/"))); asp.net中这几句代表什么? QueryString传值出现,接收到?字符,求助了! 高分求——关于web定时提醒的问题,不够再加分! 急急!!!求救求救!! 关于文件上传与下载的问题 怎么配置使用OWC???? 怎样在 客户端 做输入检测啊? 关于csdn中短消息的问题?? 在ASP.NET中将DataGrid控件中的数据导出到Excel中,用VB.net 设置gridview headertext出错 不存在此行/列的数据 急救,PageMethods问题
string str = "test/c66c3ef8/c2623bd2/App_global.asax.hmet2dpt.0.cs";
Directory.CreateDirectory(str.Substring(0, str.LastIndexOf("/")));
string str="test/c66c3ef8/c2623bd2/App_global.asax.hmet2dpt.0.cs";
if(str.LastIndexOf("/")<0)
{
if(!Directory.Exists("~/test/c66c3ef8/c2623bd2/"))
{
Directory.CreateDirectory("~/test/c66c3ef8/c2623bd2/");
}
}
string urlPath=PrePath+"test/c66c3ef8/c2623bd2/App_global.asax.hmet2dpt.0.cs"; //PrePath为你的路径前缀
System.IO.DirectoryInfo diBak = new System.IO.DirectoryInfo(urlPath);
if (diBak.Exists)
{ return strPreXMLPath;}
else
{
if(urlPath.EndWith(@"/"))
{diBak.Create();}
return diBak.FullName;
}
if(str.LastIndexOf("/") != str.Length - 1)
Directory.CreateDirectory(str.Substring(0, str.LastIndexOf("/")));