⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 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 + -