zoukankan      html  css  js  c++  java
  • System.IO.Path

     

    System.IO.Path

    分类: C# 1073人阅读 评论(0) 收藏 举报
    System.IO.Path提供了一些处理文件名和路径的方法
    2010-12-12 02:21
    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));


    文件路径:E:/Randy0528/中文目录/JustTest.rar
    更改路径字符串的扩展名。
    E:/Randy0528/中文目录/JustTest.txt
    返回指定路径字符串的目录信息。。
    E:/Randy0528/中文目录
    返回指定的路径字符串的扩展名。
    .rar
    返回指定路径字符串的文件名和扩展名。
    JustTest.rar
    返回不具有扩展名的指定路径字符串的文件名。
    JustTest
    获取指定路径的根目录信息。
    E:/
    返回随机文件夹名或文件名。
    ct2h5b2h.sed
    创建磁盘上唯一命名的零字节的临时文件并返回该文件的完整路径。
    C:/Documents and Settings/Randy/Local Settings/Temp/tmpAD.tmp
    返回当前系统的临时文件夹的路径。
    C:/Documents and Settings/Randy/Local Settings/Temp/
    确定路径是否包括文件扩展名。
    True
    获取一个值,该值指示指定的路径字符串是包含绝对路径信息还是包含相对路径信息。
    True
  • 相关阅读:
    HiveQL:数据定义
    linux学习整理
    Hive中问题解决整理
    Hive 数据类型和文件格式
    neo4j 简要安装步骤
    Leetcode 刷题笔记二 两数相加(使用链表) -- scala版本
    leetcode 刷题笔记一 两数之和 scala版本
    windows 安装 tensorflow
    elemnetui 下载,及引用
    cenos7 安装mysql
  • 原文地址:https://www.cnblogs.com/meimao5211/p/3333945.html
Copyright © 2011-2022 走看看