7,732
社区成员




Public Function getEnStr(strData As String) As String
Dim i As Integer
Dim iAsc As Integer
Dim str As String
Dim strMatch As String
If Len(strData) = 0 Then
getEnStr = ""
Exit Function
End If
For i = 1 To Len(strData)
str = Mid(strData, i, 1)
iAsc = asc(str)
If iAsc >= 65 And iAsc <= 90 Or iAsc >= 97 And iAsc <= 122 Then
strMatch = strMatch + str
End If
Next
getEnStr = strMatch
End Function
Public Function getEn(strData As String) As String
Dim re As New RegExp
Dim Match, Matches
Dim strMatch As String
If Len(strData) = 0 Then
getEn = ""
Exit Function
End If
re.IgnoreCase = True
re.Global = True
re.Pattern = "[a-z]+"
If re.Test(strData) Then
Set Matches = re.Execute(strData)
For Each Match In Matches
strMatch = strMatch + Match.Value
Next
End If
getEn = strMatch
End Function
Dim strData As String
strData = "v#$ #%打 就b々了2#【%#a %343 撒 u?ャъ┛╋┝ΥΦΩ酒 疯##V㈦㈧㈩???㊣?āB┎A"
Debug.Print getEnStr(strData), getEn(strData)