//分离路径 文件名 后缀名
2012-09-25 17:10
183 查看
//分离路径 文件名 后缀名 OpenFileDialog openFileDialog1 = new OpenFileDialog(); public void splitPathFileNameSuffix() { openFileDialog1.Filter = "All files(*.*)|*.*"; //设置打开文件的类型 openFileDialog1.ShowDialog(); string fullName = openFileDialog1.FileName.ToString(); string strPath = fullName.Substring(0, fullName.LastIndexOf("\\")); //get path string strFileName = fullName.Substring( fullName.LastIndexOf("\\") +1, (fullName.LastIndexOf(".") - fullName.LastIndexOf("\\") -1) ); //get file name string strSuffix = fullName.Substring( fullName.LastIndexOf(".") +1,(fullName.Length- fullName.LastIndexOf(".") - 1 )); //get suffix }
相关文章推荐
- [C语言(VC)] 从路径字符串中分离出文件名
- php从完整文件路径中分离文件目录和文件名的方法
- VC 中如何从字符串中分离文件名与路径+路径操作
- 分离目录路径和文件名
- 从文件路径析取文件名、后缀名和文件所处位置
- VC 中如何从字符串中分离文件名与路径
- 获取文件路径和文件名、后缀名
- qt中获取文件路径和文件名、后缀名
- 分离出文件名 路径 后缀
- linux c下,从路径名中分离文件名
- delphi从路径中分离文件名
- 绝对路径的文件名去掉目录或者去掉后缀名的简单做法
- 分离目录路径和文件名
- 获取全路径文件名的文件名/文件位置/文件的后缀名/文件的前缀
- 如何从完整的文件路径中分离文件名和路径名?
- C# 后台在完整路径中获取带有后缀名的文件名
- php从完整文件路径中分离文件目录和文件名的方法
- 如何从完整的文件路径中分离文件名和路径名?
- 丶从字符串中分离文件路径、文件名和扩展名
- DOS命令应用之分离路径和文件名