net 2.0并需要拆分字符串的最后一个/标记。目前我有一个代码Dim test As String = "Software\Microsoft\Windows\Welcome"
,需要一个代码,将软件\ Microsoft \ Windows \ Welcome分成两个单独的部分结尾
所以我将软件\ Microsoft \ Windows和欢迎作为新字符串。
我只能找到将其余部分与其他部分分开的内容,如
Dim whole As String = "Software/Microsoft/Windows/Run"
Dim firstpart As String = whole.Substring(0, whole.IndexOf("/"))
Dim lastpart As String = whole.Substring(whole.IndexOf("/") + 1)`
答案 0 :(得分:11)
Dim whole As String = "Software/Microsoft/Windows/Run"
Dim firstpart As String = whole.Substring(0, whole.LastIndexOf("/"))
Dim lastpart As String = whole.Substring(whole.LastIndexOf("/") + 1)
答案 1 :(得分:2)
尝试使用'\'拆分作为分隔符并将其存储为字符串数组。然后抓住最后一个元素,它应该是“欢迎”。