AssetDataBase _Path_Directory_File

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cui6864520fei000/article/details/88993034

PATH

string filePath =@"E:/Randy0528/中文目录/JustTest.rar";

1.更改路径字符串的扩展名。
System.IO.Path.ChangeExtension(filePath, "txt");
输出:E:/Randy0528/中文目录/JustTest.txt

2.返回指定路径字符串的目录信息。
System.IO.Path.GetDirectoryName(filePath);
输出:E:/Randy0528/中文目录

3.返回指定的路径字符串的扩展名。
System.IO.Path.GetExtension(filePath);
输出:.rar

4.返回指定路径字符串的文件名和扩展名。
System.IO.Path.GetFileName(filePath);
输出:JustTest.rar

5.返回不具有扩展名的指定路径字符串的文件名。
System.IO.Path.GetFileNameWithoutExtension(filePath);
输出:JustTest

6.获取指定路径的根目录信息。
System.IO.Path.GetPathRoot(filePath);
输出:E:/

7.返回随机文件夹名或文件名。
System.IO.Path.GetRandomFileName();
输出:ct2h5b2h.sed

8.创建磁盘上唯一命名的零字节的临时文件并返回该文件的完整路径。
System.IO.Path.GetTempFileName();
输出:C:/Documents and Settings/Randy/Local Settings/Temp/tmpAD.tmp

9.返回当前系统的临时文件夹的路径。
System.IO.Path.GetTempPath();
输出:C:/Documents and Settings/Randy/Local Settings/Temp/

10.确定路径是否包括文件扩展名。
System.IO.Path.HasExtension(filePath);
输出:True

11.获取一个值,该值指示指定的路径字符串是包含绝对路径信息还是包含相对路径信息。
System.IO.Path.IsPathRooted(filePath);
输出:True

AssetDataBase

盛典:点击进入

猜你喜欢

转载自blog.csdn.net/cui6864520fei000/article/details/88993034