zoukankan      html  css  js  c++  java
  • 文件路径,文件名,扩展名 常用操作

    string filePath = @"E:\Randy0528\中文目录\JustTest.rar";
    Response.Write("文件路径:"+filePath);
    Response.Write("<br/>更改路径字符串的扩展名。<br/>");
    Response.Write(System.IO.Path.ChangeExtension(filePath, "txt"));
    Response.Write("<br/>返回指定路径字符串的目录信息。。<br/>");
    Response.Write(System.IO.Path.GetDirectoryName(filePath));
    Response.Write("<br/>返回指定的路径字符串的扩展名。<br/>");
    Response.Write(System.IO.Path.GetExtension(filePath));
    Response.Write("<br/>返回指定路径字符串的文件名和扩展名。<br/>");
    Response.Write(System.IO.Path.GetFileName(filePath));
    Response.Write("<br/>返回不具有扩展名的指定路径字符串的文件名。<br/>");
    Response.Write(System.IO.Path.GetFileNameWithoutExtension(filePath));
    Response.Write("<br/>获取指定路径的根目录信息。<br/>");
    Response.Write(System.IO.Path.GetPathRoot(filePath));
    Response.Write("<br/>返回随机文件夹名或文件名。<br/>");
    Response.Write(System.IO.Path.GetRandomFileName());
    Response.Write("<br/>创建磁盘上唯一命名的零字节的临时文件并返回该文件的完整路径。<br/>");
    Response.Write(System.IO.Path.GetTempFileName());
    Response.Write("<br/>返回当前系统的临时文件夹的路径。<br/>");
    Response.Write(System.IO.Path.GetTempPath());
    Response.Write("<br/>确定路径是否包括文件扩展名。<br/>");
    Response.Write(System.IO.Path.HasExtension(filePath));
    Response.Write("<br/>获取一个值,该值指示指定的路径字符串是包含绝对路径信息还是包含相对路径信息。<br/>");
    Response.Write(System.IO.Path.IsPathRooted(filePath));

  • 相关阅读:
    C#线程同步(1)- 临界区&Lock
    详细解析Java中抽象类和接口的区别
    防止重复提交的几种办法
    网页中实现JSON的编辑与显示
    xcode5 ios7升级后的一系列问题解决
    hadoop-2.0.0-mr1-cdh4.2.0源码编译总结
    hadoop-2.0.0-cdh4.2.1源码编译总结
    cocos2d-iphone加入芒果广告
    hadoop2.0 eclipse 源码编译
    HBase学习笔记
  • 原文地址:https://www.cnblogs.com/TivonStone/p/2806878.html
Copyright © 2011-2022 走看看