C#-截取字符串----ShinePans

来源:互联网 发布:java编写菱形图案 编辑:程序博客网 时间:2024/05/02 02:04
//format的使用//查询今天的日期//截取字符串using System;class program{    static void Main()    {             string strAllPath = "D:\\C# ABCD\\C# abcd.exe";        string strPath = strAllPath.Substring(0, strAllPath.LastIndexOf("\\") + 1);        string strName = strAllPath.Substring(strAllPath.LastIndexOf("\\") + 1);        Console.WriteLine("文件路径:",strPath);        Console.WriteLine("文件名:", strName);        Console.ReadLine();    }}

3 0