问题描述
这是一个有点奇怪的问题,我希望有人可以帮我解决这个问题,因为我完全难过了。
我有一个字符串是:bttn1-ITEM1
有没有办法我可以读取这个字符串,所以我只得到ITEM1位?我想每次都在连字符后读取
。
例如
" bttn2-ITEM3" ; =" ITEM3"
" bttn14-ITEM27" =ITEM27
如果有人能帮我解决这个问题,我真的很感激。
This is a bit of a strange question, I hope someone can help me out on
this as I''m completely stumped.
I have a string that is: bttn1-ITEM1
Is there a way I can read this string so I just get the "ITEM1" bit? I
want to read the bit after the hyphen each time.
e.g.
"bttn2-ITEM3" = "ITEM3"
"bttn14-ITEM27" = "ITEM27"
I''d really appreciate it if anyone can help me out on this one.
推荐答案
\\\
Dim s As String =" bttn2-ITEM3"
Dim t As String = Mid(s,InStr(s," - ")+ 1)
///
- -
MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB<网址:http://dotnet.mvps.org/dotnet/faqs/>
\\\
Dim s As String = "bttn2-ITEM3"
Dim t As String = Mid(s, InStr(s, "-") + 1)
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
这篇关于选择字符串的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!