判斷字串全角半角

来源:互联网 发布:中宏数据库智能家居 编辑:程序博客网 时间:2024/05/12 08:54
    ''' <summary>
    ''' 判斷字串全角半角 2013/1/15 admin 
    ''' </summary>
    ''' <param name="str">傳入值</param>
    ''' <returns>true 半角/ false 全角</returns>
    ''' <remarks></remarks>
    Public Function CheckUniCode(ByVal str As String) As Boolean
        Dim bool As Boolean = False
        If str.Trim().Length > 0 Then
            Dim strTmp As String = str.Trim()
            Dim i As Integer = strTmp.Length
            Dim j As Integer = System.Text.Encoding.Default.GetBytes(strTmp).Length
            If i = j Then
                bool = True
            Else
                bool = False
            End If
        End If
        Return bool
    End Function


    '解密單價
    '=============================================
    Public Function UnLockPrice(ByVal str單價 As String, ByVal strGUID As String) As String
        Dim Crypt As Object
        Crypt = CreateObject("NHCrypt.Crypt")
        Crypt.PassWord = strGUID
        UnLockPrice = Crypt.DecryptStr(str單價)
    End Function


    '============================================
    '加密單價
    '============================================
    Public Function LockPrice(ByVal str單價 As String, ByVal strGUID As String) As String
        Dim Crypt As Object
        Crypt = CreateObject("NHCrypt.Crypt")
        Crypt.PassWord = strGUID
        LockPrice = Crypt.EncryptStr(str單價)
    End Function
0 0