string filePath = @"D:\Data\T01.jpg";
Path.GetFullPath(filePath);
//=> D:\Data\T01.jpg
Path.GetDirectoryName(filePath));
//=> D:\Data
Path.GetFileName(filePath);
//=> T01.jpg
Path.GetFileNameWithoutExtension(filePath);
//=> T01
Path.GetExtension(filePath);
//=> .jpg
Path.GetPathRoot(filePath);
//=> D:\
filePath.Substring(folderPath.LastIndexOf(@"\") + 1);
//=> Data
 

 

相关文章:

  • 2021-11-09
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
相关资源
相似解决方案