自定义的从字符串中提取字母及数字的VBA函数
时 间:2017-11-05 11:56:32
作 者:Big Young ID:252 城市:襄阳
摘 要:自定义的从字符串中提取字母及数字的VBA函数。
正 文:
自定义的从字符串中提取字母及数字的VBA函数:
'提取所有字母及数字(包括全角及半角):
Function ExtractAlphanumeric(strText As String) As StringDim lngI As Long
Dim strChar As String
Dim strTemp As String
For lngI = 1 To Len(strText)
strChar = Mid$(strText, lngI, 1)
If strChar Like "[A-z0-9]" Then
strTemp = strTemp & strChar
End If
Next
ExtractAlphanumeric = strTemp
End Function
'只提取半角字母及数字:
Function ExtractAsciiAlphanumeric(strText As String) As String
Dim lngI As Long
Dim strChar As String
Dim strTemp As String
For lngI = 1 To Len(strText)
strChar = Mid$(strText, lngI, 1)
If (Asc(strChar) >= 65 And Asc(strChar) <= 90) or (Asc(strChar) >= 97 And Asc(strChar) <=
122) or (Asc(strChar) >= 48 And Asc(strChar) <= 57) Then
strTemp = strTemp & strChar
End If
Next
ExtractAsciiAlphanumeric = strTemp
End Function
Access软件网QQ交流群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access怎么按年龄段来统计...(01.26)
- 【Access高效办公】上一年...(12.29)
- 用Access连续窗体制作的树...(11.03)
- 【Access高效办公】上一年...(10.30)
- Access制作的RGB转CM...(09.22)
- Access制作的RGB调色板...(09.15)
- Access制作的快速车牌输入...(09.13)
- 【Access高效办公】统计当...(06.30)
- 【Access高效办公】用复选...(06.24)
学习心得
最新文章
- Access快速开发平台--错误号...(02.02)
- Access怎么按年龄段来统计人数...(01.26)
- 【Access更新查询示例】怎么把...(01.19)
- Access快速开发平台--错误号...(01.13)
- Access快速开发平台--错误号...(01.04)
- 【Access高效办公】上一年度累...(12.29)
- Access快速开发平台--2.6...(12.24)
- Access快速开发平台企业版--...(12.10)
- SqlServer默认当前时间用什...(11.28)
- 【Access日期时间区间段查询示...(11.19)


.gif)
