Private Sub Form_Load()
ReDim priTable(0 To 255)
TableFillByString priTable(), "0", "9"
TableFillByString priTable(), "A", "Z"
End Sub
Private Sub Command1_Click()
Dim tString As String
tString = Text1.Text
If Not tString = "" Then
Dim tBytes() As Byte
tBytes() = StrConv(tString, vbFromUnicode)
Text2.Text = BytesCheck(tBytes(), priTable())
End If
End Sub
Function BytesCheck(ByRef pBytes() As Byte, ByRef pTable() As Byte) As Boolean
Dim tOutBool As Boolean
function X (str as string) as boolean
for i = 1 to len(str)
if (asc(mid(str,i,1))< asc("Z") and asc(mid(str,i,1)))> asc("A") or (asc(mid(str,i,1))< asc("9") and asc(mid(str,i,1))>asc("0")) then
x= true
else
x=false
exit function
end if
next
end function
ASCII码判定,容易理解的代码!
Function HEFA(ByVal x As String) As Boolean
HEFA = True
Dim I As Integer
For I = 1 To Len(x)
If Not (Mid(x, I, 1) Like "[A-Z]" Or Mid(x, I, 1) Like "#") Then
HEFA = False
Exit For
End If
Next
End Function