如何去点文件的后缀名??
我得到这个文件“开发部周工作报告(2007-11-16).doc ”
怎么去掉“.doc”
得到“开发部周工作报告(2007-11-16)”

解决方案 »

  1.   

    用indexof找到点,然后移除字符串后边的
      

  2.   

    string filename = "开发部周工作报告(2007-11-16).doc";
    string name = filename.Substring(0, filename.LastIndexOf("."));
      

  3.   

    string filename="开发部周工作报告(2007-11-16).doc"
    filename=filename.Remove(filename.LastIndexOf('.'));
      

  4.   


           string file = "开发部周工作报告(2007-11-16).doc";
           Response.Write(System.IO.Path.GetFileNameWithoutExtension(file));
      

  5.   

    string s1="开发部周工作报告.2007-11-16.doc";
    string s2=s1.replace(Substring(0,filename.LastIndexOf(".")),"")
    把最后一个点后面的移除