I think he wants a function which takes a string like
code:
var string = "ÿü"
and turns it into
code:
var newstring = "\xFF\x00\xFC"
or by the looks of his code
code:
var newstring = "\xFF\x00\xFC\x00"
In other words, he wants to take each character in the string, turn them into the hex unicode notation ("\x__"), insert "\x00" between each character and return the whole thing as a string. For example,
SetDataPatch("abc") will return "\x61\x62\x62".
As far as I know, a function like this is completely useless because "a" === "\x61" (someone correct me on this one
). However, if the function is to give "\\xFF\\x00\\xFC\\x00" (which will display as "\xFF\x00\xFC\x00" to the user), you can use this:
code:
function SetDataPatch(string) {
var newstring = "";
for(var i = 0; i < string.length; i++) {
newstring += "\\x" + string.charCodeAt(i).toString(16) + "\\x00";
}
Debug.Trace(newstring);
return newstring;
}