wangleping

C# 获取文件名、无后缀文件名、扩展名

C# 获取文件名、无后缀文件名、扩展名
string filePath = "E:\\test.txt";
string LUJING = "获取全路径:" + Path.GetFullPath(filePath); //E:\\test.txt
LUJING = "文件所在目录:" + Path.GetDirectoryName(filePath); //E
LUJING = "路径的根目录:" + Path.GetPathRoot(filePath); //E:\
LUJING = "文件名称有后缀:" + Path.GetFileName(filePath); //test.txt
LUJING = "文件名称没有后缀:" + Path.GetFileNameWithoutExtension(filePath); //test
LUJING = "后缀扩展名:" + Path.GetExtension(filePath); //.txt

关键要自己实践。

分类:

技术点:

相关文章:

  • 2021-07-19
  • 2022-12-23
猜你喜欢
  • 2021-12-10
  • 2021-12-10
  • 2021-08-03
  • 2021-11-22
  • 2022-12-23
相关资源
相似解决方案