Function dhCountIn(strText As String, strFind As String, _
Optional fCaseSensitive As Boolean = False) As Integer
''计算字符串中某字符的个数
Dim intCount As Integer
Dim intPos As Integer
Dim intMode As Integer
If Len(strFind) > 0 Then
If fCaseSensitive Then
intMode = vbBinaryCompare
Else
intMode = vbTextCompare
End If
intPos = 1
Do
intPos = InStr(intPos, strText, strFind, intMode)
If intPos > 0 Then
intCount = intCount + 1
intPos = intPos + Len(strFind)
End If
Loop While intPos > 0
Else
intCount = 0
End If
dhCountIn = intCount
End Function
Access软件网交流QQ群(群号:198465573) |