判断全角字符函数

来源:互联网 发布:js清空tr里的数据 编辑:程序博客网 时间:2024/05/17 04:26

Private Function SplitString(ByVal str As String) As Boolean

        Dim encoding As System.Text.Encoding
        Dim bytes() As Byte
        Dim enc As System.Text.Encoding

        enc = encoding.GetEncoding("SHIFT_JIS")
        bytes = enc.GetBytes(str)

        If bytes.Length = str.Length * 2 Then
            Return True
        Else
            Return False
        End If
     
    End Function