Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access数据库-模块/函数/VBA

计算字符串中某字符的个数

时 间:2007-10-15 13:32:56
作 者:不详   ID:70  城市:闵行
摘 要:计算字符串中某字符的个数
正 文:

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群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助