【发布时间】:2018-01-26 01:50:06
【问题描述】:
我正在尝试获取字符串的完整路径,如下所示:
ksh /u01/Utilities/SSL_Certificates/TestCert_20170724.sh
但我遇到了一个问题,我得到了
/u01/Utilities/SSL_Certificates/Tes
这是因为从 ksh 获取 4 个字符
如何获取从 0 到 "/" 的第一个索引的计数
我拥有的是这样的:
string SSL_configuration_Path = ShellCommand.Substring(ShellCommand.IndexOf("/"), ShellCommand.LastIndexOf("/"));
【问题讨论】:
-
这就是为什么首先检查documentation 通常会有所帮助。
标签: c# count substring string-length