计算字符串中某字符的个数-Victor Duane
Access软件网QQ交流学习群(群号码198465573),欢迎您的加入!
首页 >技术文章> Access数据库-模块/函数/VBA


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

发表时间:2007/10/15 13:32:56 评论(1) 浏览(10067)  评论 | 加入收藏 | 复制
   
摘 要:计算字符串中某字符的个数
正 文:
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)
 
 相关文章
【Access DCount示例】模糊统计子窗体符合条件的记录数示...  【麥田  2014/4/25】
【Access DCount示例】模糊统计表中指定值的记录数示例\...  【麥田  2014/4/28】
字符串内文字频次统计  【在水一方  2014/6/12】
查找字符串的两个函数  【在水一方  2014/11/7】
【Access扫盲知识】字段大小设置问题的讨论\Access字段大...  【麥田  2014/11/24】
【SQLServer自定义函数】取出字符串中的汉字、字母或是数字  【金宇  2015/4/14】
常见问答
技术分类
相关资源
文章搜索
关于作者

Victor Duane

文章分类

文章存档

友情链接