Hello,
Currently I am using the below script to replace all 256 ASCII chars with their known hex codes and a * infront of each, I know there's some missing, but it skips them anyway
for (z=1;z<=256;z++) {
chr = "\\"+String.fromCharCode(z);
re = new RegExp(chr,'gi');
strTemp = strTemp.replace(re,"*"+z);
}
strTemp is obviously the variable I start with. Right now, if I have a string that is more than 1 line (slight exaggeration, really a bit more that that), the script freezes. And even when it is only 1 line, it's really slow.
I know why it's doing this, because of the loop and that having to cycle through all of the Regular Expression handling.
Is there an absolute faster way? I can't use a straight-out ASCII to Dec convertor because I need to have a * infront of each changed value, or can I still use a convertor and just mod it to do that?
Any help is MUCH appreciated, thanks.
Currently I am using the below script to replace all 256 ASCII chars with their known hex codes and a * infront of each, I know there's some missing, but it skips them anyway

for (z=1;z<=256;z++) {
chr = "\\"+String.fromCharCode(z);
re = new RegExp(chr,'gi');
strTemp = strTemp.replace(re,"*"+z);
}
strTemp is obviously the variable I start with. Right now, if I have a string that is more than 1 line (slight exaggeration, really a bit more that that), the script freezes. And even when it is only 1 line, it's really slow.
I know why it's doing this, because of the loop and that having to cycle through all of the Regular Expression handling.
Is there an absolute faster way? I can't use a straight-out ASCII to Dec convertor because I need to have a * infront of each changed value, or can I still use a convertor and just mod it to do that?
Any help is MUCH appreciated, thanks.
Comment