在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
string path = "C:\\dir1\\dir2\\foo.txt"; string str = "GetFullPath:" + Path.GetFullPath(path) + "\r\n"; str += "GetDirectoryName:" + Path.GetDirectoryName(path) + "\r\n"; str += "GetFileName:" + Path.GetFileName(path) + "\r\n"; str += "GetFileNameWithoutExtension:" + Path.GetFileNameWithoutExtension(path) + "\r\n"; str += "GetExtension:" + Path.GetExtension(path) + "\r\n"; str += "GetPathRoot:" + Path.GetPathRoot(path) + "\r\n"; MessageBox.Show(str); 结果: GetFullPath:C:\dir1\dir2\foo.txt GetDirectoryName:C:\dir1\dir2 GetFileName:foo.txt GetFileNameWithoutExtension:foo GetExtension:.txt GetPathRoot:C:\
|
请发表评论