/ Published in: VB.NET
URL: http://reusablecode.blogspot.com/2009/02/add-and-strip-slashes.html
VB.NET implementation on the PHP functions by the same name, but with support for more problematic characters.
Expand |
Embed | Plain Text
<% ' Copyright (c) 2010, reusablecode.blogspot.com; some rights reserved. ' ' This work is licensed under the Creative Commons Attribution License. To view ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California ' 94305, USA. ' Despite the identical naming, these functions are more comprehensive than their PHP equivalents. ' They go above and beyond even mysql_real_escape_string(), by including support for backspace and horizontal tab. ' List of characters handled: ' \000 null ' \010 backspace ' \011 horizontal tab ' \012 new line ' \015 carriage return ' \032 substitute ' \042 double quote ' \047 single quote ' \134 backslash ' \140 grave accent ' Returns a string with backslashes before characters that need to be quoted in database queries function addslashes(unsafeString) addslashes = regEx.replace(unsafeString, "([\000\010\011\012\015\032\042\047\134\140])", "\$1") end function ' Un-quote string quoted with addslashes() function stripslashes(safeString) stripslashes = regEx.replace(safeString, "\\([\000\010\011\012\015\032\042\047\134\140])", "$1") end function %>
You need to login to post a comment.
