会员登录 - 用户注册 - 网站地图 Office中国(office-cn.net),专业Office论坛
当前位置:主页 > 技巧 > Access技巧 > 模块函数VBA > 正文

指定字符开头和结束的查找

时间:2004-01-06 00:09 来源:AccessQQ 作者:huanghai… 阅读:


'使用方法:
'findstr("我来添加文章","来","加")
'=来添加

'-----------------------------
Public Function findStr(ByVal str As String, ByVal str1 As String, ByVal str2 As String)
    Dim a, b As Integer

    If InStr(1, str, str1, 1) <> 0 Then
        a = InStr(1, str, str1, 1)
        If InStr(a, str, str2, 1) <> 0 Then
            b = InStr(a, str, str2, 1)
            findStr = Mid(str, a, b - a + 1)
        End If
    End If

End Function

(责任编辑:admin)

顶一下
(0)
0%
踩一下
(0)
0%
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价: