C# 路径字符串中提取所在目录、文件名、文件扩展名、根目录
转载自 C#_路径字符串中提取所在目录、文件名、文件扩展名、根目录
str = "获取文件所在的目录:" + Path.GetDirectoryName(filePath);
str = "获取文件的名称含有后缀:" + Path.GetFileName(filePath);
str = "获取文件的名称没有后缀:" + Path.GetFileNameWithoutExtension(filePath);        
str = "获取路径的后缀扩展名称:" + Path.GetExtension(filePath);
str = "获取路径的根目录:" + Path.GetPathRoot(filePath);
                    
                
                
            
        
浙公网安备 33010602011771号