PDA

View Full Version : 一个中文解码函数


jadeneo
07-09-06, 01:14 PM
Function fnDecode(inString As String) As String
inString=Replace(inString,"+"," ")
Dim L As String
Dim M As String
Dim R As String
Dim P As Integer
Dim TP As Integer
Dim fnDecode1 As String
Dim rstr As String
Dim TempStr As String
If Instr(inString,"%")>0 Then
TempStr=inString
Do While Instr(TempStr,"%")>0
P=Instr(TempStr,"%")
L=Left(TempStr,P-1)
M=Mid(TempStr,P+1,5)
If Cint("&H"+Left(M,1))<10 Then
M=Left(M,2)
If M="0A" Or M="0D" Then
If M="0D" Then
rstr=rstr+L+"<br>"
End If
Else
rstr=rstr+L+Chr(Clng("&H"+M))
End If
TP=(P+2)
Else
M=Left(M,2)+Right(M,2)
rstr=rstr+L+Chr(Clng("&H"+M))
TP=(P+5)
End If
R=Right(TempStr,Len(TempStr)-TP)
TempStr=R
Loop
fnDecode=rstr+TempStr
Else
fnDecode = inString
End If
End Function

没试过,刚在网上看到的,这里共享一下

ly_sl
07-09-06, 01:47 PM
龙哥真是好人啊,呵呵~

恋猪明
07-09-06, 08:07 PM
请臭龙给出注释。。。

光光发一段代码别人都不知道什么意思哦。。。。。。。。。。

天天888
09-09-06, 09:12 AM
要解中文的什么码吗?我也没弄清楚