How can I convert:
from:
'\\x3c'
to:
'<';
I tried:
s=eval(s.replace("\\\\", "")); 
does not work. How I do this? Thanks in advance!
How can I convert:
from:
'\\x3c'
to:
'<';
I tried:
s=eval(s.replace("\\\\", "")); 
does not work. How I do this? Thanks in advance!
Use String.fromCharCode instead of eval, and parseInt using base 16:
s=String.fromCharCode(parseInt(s.substr(2), 16));
 
    
    One way to do it, which will incur the wrath of people who believe that "eval" is unequivocally evil, is as follows:
var s = "\\x3c";
var s2 = eval('"' + s + '"'); // => "<"
