You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm doing a lot of database word where I'm passing some dynamic sql.
CASE WHEN [t].[VALUE] ='Foo' THEN NULL ELSE 'Bar' END
and I often need to reverse it from '' to ' as well.
I have tried it this way
copyq:
function modifyText(text)
{
// TODO: Modify text here!
return text.replace("'", "''")
}
if (!copy())
abort()
var text = str(clipboard())
var newText = modifyText(text)
if (text == newText)
abort();
copy(newText)
paste()
and it only replaces the very first ' with ''. It never gets them both. Any help appreciated.
The text was updated successfully, but these errors were encountered:
You need to use a regex text.replace(/'/g, "''"). If you don't use a regex only the first occurrence is replaced. Yo can check the documentation in String.prototype.replace().
I'm doing a lot of database word where I'm passing some dynamic sql.
and I often need to reverse it from
''
to'
as well.I have tried it this way
and it only replaces the very first
'
with''
. It never gets them both. Any help appreciated.The text was updated successfully, but these errors were encountered: