vb如何查找指定字符串的个数?

例如abbcccd里,如何知道里面有几个c?

第1个回答  推荐于2018-03-13
Dim str As String
Dim n As Integer
str = "abbcccd"
n = Len(str) - Len(Replace(str, "c", ""))本回答被网友采纳
第2个回答  2013-05-16
Private Sub Command1_Click()
Dim s As Integer
For i = 1 To Len(Text1)
If Mid(Text1, i, Len(Text2)) = Text2 Then
s = s + 1
End If
Next
Print s & "个" & Text2
End Sub
相似回答