string reportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,

来源:百度知道 编辑:UC知道 时间:2024/05/25 08:58:51
string reportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,
Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
请哪位朋友具体解释下这代码的意思。请具体些
我知道“LastIndexOf()方法用来取得指定字符串的最后一个匹配项的索引位置”这些函数的意思,想知道具体过程、一般怎么用的
谢谢~~~
比如为什么要用两个 LastIndexOf("\\"))? 为什么有 两个“\\”...
谢谢

我只知道为什么要用两个“\\”,因为 ‘\’ 代表转义字符,若用一个 ‘\’ ,那么‘\’ 就会与后面的 ”组合在一起,表示双引号字符啦!! 就无法输出‘\’

\是特殊字符,所以需要\\,第一个代表转义.