C# equivalence of php addslashes?

  • Thread starter Thread starter craig
  • Start date Start date
C

craig

Is there a C# function to add escape characters
to strings?

I need to do this because I'm using a database
that must have double-quotes escpaped (" converted to \")

Thanks.
 
craig said:
Is there a C# function to add escape characters
to strings?


Have you tried Regex.Escape? There's also the Replace method of the
string class.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
If you use parameters this will be handled for you. That also prepares your
code nicely in case you want to move to a stored procedure at a later date.


Eric
 
Back
Top