Hello I have a string like this
"'Ade', 'Danidee', 'Lamarr', 'O'Connor', 'Austino', 'N'golo',"
I need to be able to escape the single Quote character so the output will be like this
"'Ade', 'Danidee', 'Lamarr', 'O\'Connor', 'Austino', 'N\'golo',"
I have tried something like
Splitting the string with coma(,) in to a list
loop through it and checking if single quote is in each item
Then
item.replace("'", "\'")
Append it to a new list and join it with (,) again
Is there a way I can do it directly without going through all that?
I need to be able to do something like
str.replace("'", "\'")
But that will replace the whole single quotes
'Ade'
will become Ade
i don't want that
Thanks.