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

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

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

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

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

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

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

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

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

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

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

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

System.IO.Path 文件名、路径、扩展名 处理的更多相关文章

  1. System.IO.Path 文件名、路径、扩展名处理

    string filePath =@"E:/Randy0528/中文目录/JustTest.rar"; 更改路径字符串的扩展名.System.IO.Path.ChangeExten ...

  2. System.IO.Path文件路径类

    Path类的静态属性和方法,此类操作不影响物料文件. 属性 char a = System.IO.Path.VolumeSeparatorChar;//: char b = System.IO.Pat ...

  3. [原]System.IO.Path.Combine 路径合并

    使用 ILSpy 工具查看了 System.IO.Path 类中的 Combine 方法 对它的功能有点不放心,原方法实现如下: // System.IO.Path /// <summary&g ...

  4. C# 获取文件名及扩展名

    C# 获取文件名及扩展名 string aFirstName = aFile.Substring(aFile.LastIndexOf("\\") + 1, (aFile.LastI ...

  5. C# 获取文件名及扩展名【转】

    https://www.cnblogs.com/libushuang/p/5794976.html C# 获取文件名及扩展名 string aFirstName = aFile.Substring(a ...

  6. System.IO.Path类

    System.IO.Path为路径的操作封装了很多很有的东西,利用该类提供的方法能够快速处理路径操作的问题.下面详细了解一下. 1.属性 属性太复杂了,反映什么系统平台的信息,看不懂,等以后看得懂了再 ...

  7. C#使用System.IO.Path获取文件路径、文件名

    class Program { static void Main(string[] args) { //获取当前运行程序的目录 string fileDir = Environment.Current ...

  8. Asp.Net 获取FileUpload控件的文件路径、文件名、扩展名

    string fileNameNo = Path.GetFileName(FileUploadImg.PostedFile.FileName); //获取文件名和扩展名string Directory ...

  9. os.path.splitext()用法--分离文件名与扩展名

    用法: os.path.splitext(“文件路径”)    分离文件名与扩展名:默认返回(fname,fextension)元组,可做分片操作 例子: import os path_01='E:\ ...

随机推荐

  1. 【252】◀▶IEW-Unit17

    Unit 17 Social Issues: Population 复杂表格写作技巧 1.Model1对应图片分析 The table contains information about the d ...

  2. hadoop学习笔记之-hbase完全分布模…

    安装环境: OS: Oracle linux 5.6 JDK: jdk1.6.0_18 Hadoop: hadoop-0.20.2 Hbase: hbase-0.90.5 安装准备: 1. Jdk环境 ...

  3. UVaLive 3266 Tian Ji -- The Horse Racing (贪心)

    题意:田忌赛马,每胜一局就得200,负一局少200,问最多得多少钱. 析:贪心,如果最快的马比齐王的还快,就干掉它,如果最慢的马比齐王的马快,就干掉它,否则用最慢的马去和齐王最快的马比. 代码如下: ...

  4. GridView 中RowDataBound 获取绑定后的各个字段的值

    protected void GridView_dept_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType ...

  5. docker中容器和镜像的区别

    自学docker过程中一直搞不明白 镜像容器的关系,网上查阅看到一篇文章觉得讲的很好,转载记录. 转自 http://blog.csdn.net/chszs/article/details/48252 ...

  6. 洛谷P4003 无限之环(费用流)

    传送门 神仙题啊……不看题解我可能一年都不一定做得出来……FlashHu大佬太强啦 到底是得有怎样的脑回路才能一眼看去就是费用流啊…… 建好图之后套个板子就好了,那么我们着重来讨论一下怎么建图 首先, ...

  7. 有关xerosploit运行报错问题的有效解决方案

    [安装xerosploit]安装xerosploit的步骤如下,我是将xerosploit直接克隆到了根目录下(使用“cd /”到达根目录) git clone https://github.com/ ...

  8. Java - 一道关于整型和字符类型相加的题目

    题目 public class Test { public static void main(final String[] args) { final int a = 10; final int b ...

  9. Js 实现全屏

    <input id="Button1" type="button" value="开始全屏" onclick="kaishi ...

  10. Mac用brew安装MySQL

    1.先安装brew 网址:https://brew.sh/ 复制命令:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent ...