string strPath = textBox1.Text.Substring(0, textBox1.Text.LastIndexOf("\\"));
string strName=textBox1.Text.Substring(textBox1.Text.LastIndexOf("\\")+1,(textBox1.Text.LastIndexOf(".")-textBox1.Text.LastIndexOf("\\")-1) );
string strEName = textBox1.Text.Substring(textBox1.Text.LastIndexOf(".")+1, (textBox1.Text.Length - textBox1.Text.LastIndexOf(".")-1));
MessageBox.Show("文件路径:"+strPath +"\n 文件名:"+strName +"\n 文件扩展名:"+strEName ,"信息",MessageBoxButtons.OK,MessageBoxIcon.Information );
C#分离文件和路径的方法
最新推荐文章于 2024-08-07 11:40:55 发布