【水汐のC#窗口】用输出参数求文件路径中的目录和文件名
程序员文章站
2022-03-04 13:07:39
...
用输出参数求文件路径中的目录和文件名
class Analyzer
{
public void SplitPath(string path,out string dir,out string filename)
{
int i = path.LastIndexOf('\\');
dir = path.Substring(0, i);
filename = path.Substring(i + 1);
}
}
private void button5_Click(object sender, EventArgs e)
{
string path = textBox1.Text;
string dir, file;
Analyzer a = new Analyzer();
a.SplitPath(path, out dir, out file);
textBox2.Text = dir;
textBox4.Text = file;
}
上一篇: torch.nn.embedding()
下一篇: Date操作类