#define STRING_LEN 500 && * 1024 #define LOOP_COUNT 11 lcURL = "" for i = 1 to STRING_LEN lcURL = lcURL + "%" + right(transform(i % 256, "@0"), 2) + replicate("X", 1022) endfor clear ss1 = seconds() for i = 1 to LOOP_COUNT lcResult1 = URLDecode1(lcURL) endfor ? seconds() - ss1 ss1 = seconds() for i = 1 to LOOP_COUNT lcResult2 = URLDecode2(lcURL) endfor ? seconds() - ss1 ? lcResult1 == lcResult2 ? len(lcResult1), len(lcResult2) function URLDecode1 *** URLDecodes a text string: * Replaces %hh tokens with ascii characters *** Input: tcInput - Text string to decode *** Return: Decoded string * Author: Nick lparameter tcInput local lnPcntPos, lcOutput lcOutput="" tcInput=strtran(tcInput, "+", " ") do while !empty(tcInput) lnPcntPos=at("%",tcInput) if betw( lnPcntPos, 1, len(tcInput)-2 ) lcOutput= m.lcOutput+ left(tcInput, ; lnPcntPos-1)+chr(eval('0x'+substr(tcInput,lnPcntPos+1,2))) tcInput=substr(tcInput,lnPcntPos+3) else lcOutput=m.lcOutput+ m.tcInput exit endif enddo return lcOutput function URLDecode2 *** URLDecodes a text string: * Replaces %hh tokens with ascii characters *** Input: tcInput - Text string to decode *** Return: Decoded string * Author: Albert lparameter tcInput local lnPcntPos, lcOutput, lnPcntCount, i tcInput = strtran(tcInput, "+", " ") local array laPercents[1] lnPcntCount = alines(laPercents, strtran(tcInput, "%", chr(13))) lcOutput = laPercents[1] for i = 2 to lnPcntCount lcOutput = m.lcOutput + chr(evaluate('0x' + left(laPercents[i], 2))) + ; substr(laPercents[i], 3) endfor return lcOutput