1. C # Gets the suffix file name, suffix name, and file name according to the absolute path.
1 String str = "F:\test\Default.aspx"; 2 string filename = System.IO.Path.GetFileName (str);//filename "default.aspx "3 string extension = System.IO.Path.GetExtension (str);//extension". aspx "4 string filenamewithoutextension = System.IO.Path.GetFileNameWithoutExtension (str);//filename with no extension "Default" 5 6 string directory= System.IO.Path.GetDirectoryName (PhysicalPath);
2. C # Gets the suffix file name, suffix name, and file name, using the Split function, based on the absolute path.
1 String str = = "F:\test\Default.aspx"; 2 char[] delimiterchars = {'. ', ' \ \ '};3 string[] mystr = str. Split (Delimiterchars); 4 string sheetname = mystr[mystr.length-2];);//File name "Default" with no extension
". Net" C # Gets the file path with the suffix file name, suffix name, file name, without file name based on absolute path