W
William Carpin
Okay, given the following string:
"This is Will's string!"
what I'm trying to do is replace the single-tick "'" character with a
backslash/single-tick "\'", so I can use use that string in a sql query.
To do this in Perl, you'd do the following:
myString =~ s/\'//g;
...which doesn't work in Ruby.
I also tried using the gsub function, with "\\\'" passed in as the
second parameter, and it just started outputting some sort sort of
goofiness with characters replaced by sub-elements of the string for
which I was calling the function on and the like.
I scoured Google for awhile but didn't find anything. Any ideas?
"This is Will's string!"
what I'm trying to do is replace the single-tick "'" character with a
backslash/single-tick "\'", so I can use use that string in a sql query.
To do this in Perl, you'd do the following:
myString =~ s/\'//g;
...which doesn't work in Ruby.
I also tried using the gsub function, with "\\\'" passed in as the
second parameter, and it just started outputting some sort sort of
goofiness with characters replaced by sub-elements of the string for
which I was calling the function on and the like.
I scoured Google for awhile but didn't find anything. Any ideas?