Posted By


sarfraznawaz2005 on 03/24/09

Tagged


Statistics


Viewed 114 times
Favorited by 0 user(s)

Addslahes, Stripslashes


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function addslashes(str) {
  2. str=str.replace(/\'/g,'\\\'');
  3. str=str.replace(/\"/g,'\\"');
  4. str=str.replace(/\\/g,'\\\\');
  5. str=str.replace(/\0/g,'\\0');
  6. return str;
  7. }
  8.  
  9. function stripslashes(str) {
  10. str=str.replace(/\\'/g,'\'');
  11. str=str.replace(/\\"/g,'"');
  12. str=str.replace(/\\\\/g,'\\');
  13. str=str.replace(/\\0/g,'\0');
  14. return str;
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.