Vb 实现简体转繁体

 '//LCmapString  映像字符串
Private Declare Function LCMapString Lib "kernel32" Alias "LCMapStringA" ( _
                                                                          ByVal Locale As Long, _
                                                                          ByVal dwMapFlags As Long, _
                                                                          ByVal lpSrcStr As String, _
                                                                          ByVal cchSrc As Long, _
                                                                          ByVal lpDestStr As String, _
                                                                          ByVal cchDest As Long _
                                                                          ) As Long
                                                                         
'// lstrlen 返回字符串中字符数
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long



'简体转繁体

Public Function JtToFt(ByVal Ls_Str As String) As String
      
       Dim Li_StrLen As Long ' 字符串的长度
       Dim Ls_Ret As String ' 返回转回后的字符串
      
       Li_StrLen = 0
       Li_StrLen = lstrlen(Ls_Str)
       Ls_Ret = Space(Li_StrLen) ' 产生一定长度的空间 用于接收返回后的字符串
   
     
     
       LCMapString &H804, &H4000000, Ls_Str, Li_StrLen, Ls_Ret, Li_StrLen
     
       JtToFt = Ls_Ret
End Function


'繁体转简体

Public Function FtToJt(ByVal Ls_Str As String) As String
  
               Dim Li_StrLen As Long ' 字符串的长度
               Dim Ls_Ret As String  '返回的字符串
                      
               Li_StrLen = 0
               Ls_Ret = ""
               Li_StrLen = lstrlen(Ls_Str)
               Ls_Ret = Space(Ls_Str) ' 产生一定的长度的空间 用于接收返回后的字符串
              
               LCMapString &H804, &H200000, Ls_Str, Li_StrLen, Ls_Ret, Li_StrLen
              
               FtToJt = Ls_Ret
End Function

你可能感兴趣的:(Vb 实现简体转繁体)