當(dāng)前位置:
首頁(yè) >
C# 获得文件名
發(fā)布時(shí)間:2025/5/22
59
豆豆
string strFilePaht="文件路徑";Path.GetFileNameWithoutExtension(strFilePath);這個(gè)就是獲取文件名的還有的就是用Substring截取strFilePaht.Substring(path.LastIndexOf("\\") + 1, path.Length - 1 - path.LastIndexOf("\\"));strFilePaht.Substring(path.LastIndexOf("."), path.Length - path.LastIndexOf("."));或者用openFileDialog1.SafeFileName
?
總結(jié)
- 上一篇: C#用了多线程界面还是卡死
- 下一篇: C# winform combobox