Private Sub Command1_Click()
MsgBox UBound(Split("aaa1ffff1hh1", "1"))
MsgBox strnumber("aaa1ffff1hh1", "1")
End Sub
Function strnumber(ByVal x As String, ByVal findstr As String) As Long
Dim temp As Long
x = Replace(x, " ", "")
temp = Len(x)
x = Replace(x, findstr, "")
strnumber = (temp - Len(x)) \ Len(findstr)
End Function
Function getNumber(strSource As String, strSplit As String) As Integer
Dim Tmp() As String
Tmp = Split(strSource, strSplit)
getNumber = UBound(Tmp)
End Function
Private Sub Form_Load()
MsgBox strTime("aaa1ffff1hh1", "1")
End Sub
Private Function strTime(ByVal Str As String, ByVal str2 As String) As Integer
Dim I As Integer
Dim J As Integer
J = 0
For I = 1 To Len(Str)
If Mid(Str, I, 1) = str2 Then
J = J + 1
End If
Next
strTime = J
End Function