![](/img/trans.png)
[英]How Can I Divide Two Field In SharePoint With Visual Studio C#
[英]How can I divide a C# string into two?
我想输出一个路径:
string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder
Debug.WriteLine((libraryPath));
但是路很长。
如何以两行输出路径。 在第二行的前1/2,然后第二1/2?
使用SubString拆分输出。
// Print 1st half (from index 0 to half of length)
Debug.WriteLine((libraryPath.SubString(0, libraryPath.Length / 2)));
// Print 2nd half (from middle of string to end)
Debug.WriteLine((libraryPath.SubString(libraryPath.Length / 2)));
注意:如果“ Length
为奇数,则前半部分将较短。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.