Private Sub Command1_Click()
Dim i As Integer, j As Integer, a As String
Text1 = "我我我我我你你你你你你他他他" 'text1输入的字符串,测试使用
a = "我"'检测我出现的次数
For j = 1 To Len(Text1.Text)
If Mid(Text1.Text, j, 1) = a Then i = i + 1
Next j
MsgBox a & "共出现" & i & "次"
End Sub
Private Sub Command1_Click()
Dim i As Integer, j As Integer, a As String
Text1 = "我我我我我你你你你你你他他他" 'text1输入的字符串,测试使用
a = "我"'检测我出现的次数
For j = 1 To Len(Text1.Text)
If Mid(Text1.Text, j, 1) = a Then i = i + 1
Next j
MsgBox a & "共出现" & i & "次"
End Sub