[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: String: addslashes
- From: Romulo Bahiense <romulo@...>
- Date: Wed, 11 May 2005 16:20:02 -0300
http://www.php.net/manual/en/function.addslashes.php
You should try:
-- Preffix with slashes (Sybase off)
function addslashes(s)
return (string.gsub(s, '([\'\"])', '\\%1'))
end
-- Double quote instead of preffixing with slashes (Sybase on)
function addslashes(s)
return (string.gsub(s, '([\'\"])', '%1%1'))
end
-- First function (slashes)
--~ print(addslashes("Testing some 'quoted' text"))
--> Testing some \'quoted\' text
-- Second function (double quotes)
--~ print(addslashes("Testing some 'quoted' text"))
--> Testing some ''quoted'' text
--rb