Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道应该使用这个值 Substring 但我不确定如何在 C# 中执行此操作。非常感谢您给定的代码。谢谢!
我想改变这个:
"C:\\TFS\\Deployment\\files\\1.0.1.1\\test\\test00.xml"
新值:
"C:\\TFS\\Deployment\\files\\1.0.1.1"
var testPath = System.IO.Directory.GetParent(path); var newValue = System.IO.Directory.GetParent(testPath);
好吧,很难确定使用什么标准来截断字符串。除了博士的回答:
"C:\\TFS\\Deployment\\files\\1.0.1.1\\test\\test00.xml".Substring(0,31);