📄 indexof
字号:
PrivateFunctionSplitStringIntoWords() AsInteger
Dim strComplete As String = "This-is a complete sentence."
DimstrWords() As String
DimstrSeparators() AsChar = {" "c, "-"c}
strWords = strComplete.Split(strSeparators)
Dim i As Integer
Fori = 0 To UBound(strWords)
MessageBox.Show(strWords(i))
Next
EndFunction
Private Function FindNumberOfOccurrences() AsInteger
Dim iPos As Integer, iMatch As Integer
Dim strSearchFor As String = "very"
Dim strSearchIn As String = "This is a very very long sentence."
Do iPos = strSearchIn.IndexOf(strSearchFor, iPos)
If iPos <> -1 Then
iMatch += 1
iPos += strSearchFor.Length
EndIf
LoopUntil iPos = -1
MessageBox.Show(iMatch)
EndFunction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -