//相對路徑 string FilePath = Server.MapPath("./") + "ImageFile/Images/" + DateTime.Now.Year.ToString() + "Year/" + DateTime.Now.Month.ToString() + "Month/"; DirectoryInfo di = new DirectoryInfo(FilePath); if (!di.Exists)//若是沒有就建立 {di.Create();} //絕對路徑 string receivePath = @"C:/ImageFile/Images/" + DateTime.Now.Year.ToString() + "Year/" + DateTime.Now.Month.ToString() + "Month/"; DirectoryInfo di = new DirectoryInfo(receivePath); if (!di.Exists) { di.Create(); }
var getStr = Str.Split(new string[] { "$tempId$" }, StringSplitOptions.None);
string Name ="asdsa,asdsa,21321," Name = Name .TrimEnd(','); //輸出以後 asdsa,asdsa,21321