Click to See Complete Forum and Search --> : StripSlashes and AddSlashes?
fixato
12-11-2002, 02:12 PM
Is there a build in function in JavaScript to strip and add slashes to strings? Something like the StripSlashes and AddSlashes() functions in PHP.
If there isn't can someone write it for me or give me instructions?
Thx in Advance,
[XMB] FiXato
fixato
12-18-2002, 12:49 PM
No-One?
http://selfhtml.teamone.de/navigation/quickbar/index.htm there you will find most of those functions
Oh, use the quickbar on the top!
jeffmott
12-18-2002, 02:31 PM
I don't believe they are built-in, but they can be easily mimiced.
function AddSlashes( str ) {
return str.replace(/(['"\\\x00])/g, "\\$1");
}
function StripSlashes( str ) {
return str.replace(/\\(['"\\\x00])/g, "$1");
}