• ASP.NET获取文件名,后缀名


    using System.IO;  //引入命名空间     

             string path = "text.aspx";
             string pathName = Path.GetFileName(path);       //获取文件全名 text.aspx
             string pathName1 = Paht.GetFileNameWithoutExtension(path);    //获取文件名 text
             string pathName2 = Path.GetExtension(path);    //获取文件后缀名 aspx

        

    FileInfo 类

             FileInfo fi = new FileInfo("C:/abc.txt");
             fi.Extension 值:.txt

  • 相关阅读:
    29.内置方法中之描述符
    28. 面向对象进阶之内置方法上
    Sort Colors*
    Implement Trie (Prefix Tree)
    Course Schedule
    Permutations
    Reverse Linked List
    Decode Ways
    Subsets *
    Longest Consecutive Sequence *
  • 原文地址:https://www.cnblogs.com/spring_wang/p/3064484.html
Copyright © 2020-2023  润新知