我有一个文本框,如“ Spring street”之类的文本,我想拆分成两个单词,并得到每个单词的第一个字符,例如
“ SS” 我是初学者,请帮助我
答案 0 :(得分:0)
' Split string based on spaces.
Dim words As String() = s.Split(New Char() {" "c})
Dim answer As string
answer = answer(0).Substring(0, 1) + answer(1).Substring(0, 1)
答案 1 :(得分:0)
欢迎stackoverflow。
下面是一段返回请求的代码
' Define the string that needs to be splitted
Dim texttosplit As String = "Spring street"
' Split the string into words
Dim words As String() = texttosplit.Split(" ")
' Loop each word to compile a result string
Dim resultstring As String = Nothing
For Each word As String In words
resultstring = resultstring & word.First
Next