VB6如何把汉字转换成五笔编码
VB6如何把汉字转换成编码比如:我爱编程论坛 的五笔编码为: q ep xyna tkgg ywx ffc
[此贴子已经被作者于2022-4-29 16:49编辑过]
Private Sub Form_Load() Text1 = "我爱编程论坛" End Sub Private Sub Command1_Click() For i = 1 To Len(Text1) Debug.Print Mid(Text1, i, 1), GetWubi(Mid(Text1, i, 1)) Next End Sub Function GetWubi(s As String) As String On Error Resume Next Dim HttpRequest 'As WinHttpRequest Dim HtmlDoc 'As MSHTML.HTMLDocument Dim htmlLi Set HttpRequest = CreateObject("WinHttp.WinHttpRequest.5.1") Set HtmlDoc = CreateObject("htmlfile") With HttpRequest .open "Get", "https://hanyu.baidu.com/zici/s?wd=" & Left(s, 1) .send HtmlDoc.body.innerHTML = .responseText End With Set htmlLi = HtmlDoc.body.getElementsByTagName("li") For i = 0 To htmlLi.length - 1 If htmlLi(i).id = "wubi" Then GetWubi = htmlLi(i).getElementsByTagName("span")(0).innerText Exit Function End If Next End Function