7,762
社区成员
发帖
与我相关
我的任务
分享
Function change(str As String) As String
Dim i As Integer
Dim tmp As String '未处理的字符串
Dim rst As String '处理过的16进制字符串
Dim s_head As String
Dim s_tail As String
Dim i_head As Integer
Dim i_tail As Integer
tmp = ""
rst = ""
s_head = ""
s_tail = ""
i_head = InStr(str, "@(")
i_tail = InStr(str, ")")
If i_head <> 0 Then
If i_tail = 0 Then
MsgBox "打印固定数据格式不正确!"
Else
s_head = s_head & Mid(str, 1, i_head - 1)
s_tail = s_tail & Mid(str, i_tail + 1, Len(str))
tmp = tmp & Mid(str, i_head + 2, i_tail - 1)
For i = 1 To Len(tmp) Step 2
rst = rst & Chr(CInt("&H" & Mid(tmp, i, 2)))
Next i
'写入文件的字符串
change = s_head & rst & s_tail
End If
Else
change = str
End If
End Function