入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

字符判断

创建时间:2009-04-24 投稿人: 浏览次数:288


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

声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
  • 上一篇:没有了
  • 下一篇:没有了
未上传头像