VB 十六进制转汉字的函数

Public Function HexToStr(ByVal strs As String) As String
  Dim i As Integer, tmp As String, n
    
  If Len(strs) Mod 2 Then Exit Function
    
  For i = 1 To Len(strs) Step 2
          n = Val("&H" & Mid(strs, i, 2))
          If n < 0 Or n > 127 Then
                  n = Val("&H" & Mid(strs, i, 4))
                  i = i + 2
          End If
          tmp = tmp & Chr(n)
  Next i
  HexToStr = tmp
  End Function

  

nan =  HexToStr("C4CF") 
nan = "南"
原文地址:https://www.cnblogs.com/blackice/p/3779845.html