zoukankan      html  css  js  c++  java
  • Path类

    1.Path.Combine将字符串组合成为一个路径

    string str1 = "d:\\";
                string str2 = "windows\\";
                string str3 = "system";
                string strname = Path.Combine(str1, str2, str3);

    这里需要注意string str1 = "d:\\"; 必须为这种格式不能省略,而后面的str2可以省略,加不加\\都可以,系统会自动判断

    string str = @"J:\\qiufeng\\0000.txt";
                string str1 = Path.GetDirectoryName(str);//返回目录信息J:\\qiufeng\\123\\0000.txt";则是J:\\qiufeng\\123 
                string str2 = Path.GetExtension(str);//获得文件扩展名
                string str3 = Path.GetFileName(str);//返回指定字符串的文件名和扩展名
                string str4=Path.GetFileNameWithoutExtension(str);返回指定字符串的文件名,不返回扩展名 
                string str5 = Path.GetFullPath("ASCII.html");//返回指定字符串的绝对路径
                string str6 = Path.GetPathRoot(str);//返回指定字符串的根目录
                string tempPath = Path.GetTempPath();//临时文件所在目录
                tempPath = Path.GetTempFileName();//获得临时文件名
    image[2]_thumb[2]
    Path.GetTempFileName()永远不会重复,就算我们手动添加tmp8506.tmp,下次返回还是新的
     
     

               

               

  • 相关阅读:
    oracle 绿色版本 instantclient 使用说明
    response 后刷新页面,点击按钮后,禁用该按钮
    模式对话框里的CheckedChanged事件
    PDF合并
    Android手机上抓包神器
    春社日的推算方法
    Web APi入门之Self-Host(二)
    Web Api之Cors跨域以及其他跨域方式(三)
    Web APi入门之基本操作(一)
    Self Host WebApi服务传输层SSL加密(服务器端+客户端调用)
  • 原文地址:https://www.cnblogs.com/automation/p/2872054.html
Copyright © 2011-2022 走看看