Code archives/Networking/urlencode for string
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
i have this string SHE2648_00-GAL-global%3Fwid%3D430%26hei%3D430%26%24jpglarge%24 i want this string SHE2648_00-GAL-global?wid=430&hei=430&$jpglarge$ (need hex2dec function) use for your fun. | |||||
Function urlencode(htmlstringa$) begin=1 pos=0 numcar=Len(htmlstringa) finito=0 While begin<numcar And finito=0 trovato=Instr(htmlstringa,"%",begin) If trovato<>0 Then stringasx$=Mid(htmlstringa,1,trovato-1) stringadx$=Mid(htmlstringa,trovato+3,numcar) numesa$=Mid(htmlstringa,trovato+1,2) intero=hex2dec(numesa$) If intero<>-1 Then htmlstringa=stringasx$+Chr$(intero)+stringadx$ EndIf begin=trovato+1 Else finito=1 EndIf Wend End Function Function hex2dec(hexin$) Local c, dec, hexval$ = "0123456789ABCDEF" For c=1 To Len(hexin$) dec = (dec Shl 4) Or (Instr(hexval$, Upper$(Mid$(hexin$, c, 1))) - 1) Next Return dec End Function |
Comments
| ||
Of course, you mean urlDEcode... since traditionally, encoding is what converts URL characters to Hex. :-) |
| ||
oh yes you say right, but hovewer i call the white color white because i accept your convention.... thanks for correction. |
Code Archives Forum