Re: PHP "stripclashes" equivalent in Ruby/Rails?

Jamal Soueidan
Sun, 22 Jul 2007 17:11:24 -0000

Ben Knight wrote:
> Hi, Jamal.  I ended up using the delete function and you are right, it
> wasn''t hard :-)  I wasn''t sure what the PHP function did
exactly since
> I''m not a PHP developer but I ended up doing something like this
and I
> believe it duplicates the PHP functionality:
>
>
data.delete(''\r'').delete(''\n'').delete("\\")
>
>
> Jamal Soueidan wrote:
>> Well, It shouldn''t be hard :)
>>
>> Does the function just strip the slashes as below?
>>
>> Example
>> \''nice\nguy\''
>>
>> Result
>> ''nice
>> guy''

If you just want to remove them, then you can use the delete function as
you did.

But you must understand that

\n is like
\\ is like \
\t is like TABKEY

So you might want to think about that :)