tags:

views:

103

answers:

1

Hello,

Does .net have the equivilent of Delphi's QuotedStr function. This replaces all quotes with two quote characters and then adds a quote to the start and the end, e.g.

Lets assume the varaible s holds the string:

Welcome to Steve's Store

then QuotedStr(s) would return:

'Welcome to Steve''s Store'
+1  A: 

Like this:

"'" + str.Replace("'", "''") + "'"
SLaks
No this has nothing to do with SQL
AJ
Thanks, so there is no built in function?
AJ
Yes there is no in built function
btlog
You can however create a help extension method for this assuming you're using .Net 3.5 +
saret