>I need a fast way to convert relatively large ascii strings to their "escaped" hex equivalent for use within dynamically generated javascript. Here I mean where "ABC" becomes "%41%42%43". This will be used as a support routine on a web server for generating portions of web pages that are intentionally obfuscated. It needs to be fast and callable from a VFP COM DLL that is working in conjunction with an ASP app to generate the web pages.
>
>The STRCONV function with opcode of 15 is very close in that it produces an ascii to hex conversion, but it does not include the javascript escape character "%".
>
>var cNew="";
>for (var i=0; i> cNew+= "%" + cStr.substr(i,2);
> }
>return unescape(cNew);
>}
>
>Thanks very much for any suggestions.
Why don't you write a partially optimzed vfp or javascript solution ? The c/c++ version will be faster, but not by that far a margin than if you use a worst case approach similar to the above<g>. If you are already unsure how to proceed with a fll, how will it be if you want to add/change a few more functions with similar functionality? If possible, keep it the language domains you know. I strongly doubt that implementing a transformation like that will be the bottleneck of a vfp-web-app if the conversion is coded in vfp.
In nearly all dynamically memory allocating languages you run into string/memory thrashing. Depending on the size of the strings I'ld try a few simple tricks in vfp first - for instance in MB-sized strings check writing to allocated memory or a file or in intermediate size inplement something similar as the CLR to always append groups of characters in a single line.
HTH
thomas
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only