C#获取文件扩展名-技术&分享
来源:互联网 发布:淘宝店铺违规考试答案 编辑:程序博客网 时间:2024/05/29 12:15
方法一:
string fileFullName="D:\OneKey.exe";Path.GetExtension(fileFullName);指定的路径的扩展名(包含句点“.”)、null 或 String.Empty。 如果 path 为 null,则 GetExtension 返回 null。 如果 path 不具有扩展名信息,则 GetExtension返回 String.Empty。
方法二:
/// <summary>/// Hzfile/// 获取指定文件的扩展名/// </summary>/// <param name="filePath">指定文件的绝对路径</param>/// <returns>返回文件的扩展名,如果文件扩展名为空或文件路径错误则返回空</returns>public string GetFileExtension(string filePath){ string filePathExtension = ""; try { if (Directory.Exists(filePath)) { filePathExtension = filePath.Substring(filePath.LastIndexOf(".") + 1); } } catch (Exception ex) { MessageBox.Show(ex.Message); return ""; } return filePathExtension;}
0 0
- C#获取文件扩展名-技术&分享
- C#如何获取文件扩展名
- C#通过文件路径获取文件名、扩展名
- 获取文件扩展名
- php获取文件扩展名
- java 获取文件扩展名
- java获取文件扩展名
- 获取文件的扩展名
- jQuery--获取文件扩展名
- 获取文件扩展名
- Lua_获取文件扩展名
- 获取文件扩展名方法
- shell获取文件扩展名
- 获取文件扩展名(后缀)
- php 获取文件扩展名
- PHP获取文件扩展名
- C# 通过文件路径获取文件名、扩展名等
- C# 通过文件路径获取文件名、扩展名等
- SSH applicationContext.xml import异常
- jQuery获取option
- 漫水效果的进度条
- C# Double保留小数点后面位数
- innobackupex的使用
- C#获取文件扩展名-技术&分享
- 接口的相关知识总结
- Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
- 构造函数中的throw
- Nt Kernel & System 占用80端口
- vim配置
- c#大文件拷贝详细
- 1. 函数的定义和调用
- Erlang环境搭建 for mac os