字符判断
Public Function IsNumeric(Str As Variant) As Boolean
" NULL
If Information.IsNull(Str) Then
IsNumeric = False
Exit Function
End If
" EMPTY
If Information.IsEmpty(Str) Then
IsNumeric = False
Exit Function
End If
"
If Not Information.IsNumeric(Str) Then
IsNumeric = False
Exit Function
End If
Dim iLen As Integer
iLen = Strings.Len(Str)
" 半角
If iLen <> Strings.Len(Strings.Trim(Str)) Then
IsNumeric = False
Exit Function
End If
" 全角
If iLen <> Strings.LenB(Strings.StrConv(Str, vbFromUnicode)) Then
IsNumeric = False
Exit Function
End If
IsNumeric = True
Exit Function
End Function
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。