note 14098 deleted from function.addslashes by didou
| From: | didou@php.net | Date: | Sun, 18 May 2003 00:56:35 +0000 |
| Subject: | note 14098 deleted from function.addslashes by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48304@lists.php.net to get a copy of this message | ||
Note Submitter: geggert@web.de
----
_JAVA-SCRIPT_ has no precast possibility to get rid off added slashes (as far as I know).
I wrote this function to fix this little deficit:
function stripslashes (arbstrg) {
if (typeof arbstrg != 'string') return arbstrg;
if (arbstrg.length > 1) {
for(qqq=arbstrg.length-2; qqq>=0; qqq--) {
if (arbstrg.substring(qqq,qqq+1) == "\\") {
hlpchr = arbstrg.substring(qqq+1,qqq+2);
if ((hlpchr == "\'") || (hlpchr == "\"") || (hlpchr
== "\\")) {
helpstrg = arbstrg.substring(qqq+1,arbstrg.length);
arbstrg = arbstrg.substring(0,qqq);
arbstrg = arbstrg+helpstrg; } } } }
return arbstrg; }
hope it'll help some people ...