Replace Quotes with Escaped Quotes in String

Brahmanathaswami brahma at hindu.org
Tue Dec 15 01:16:55 EST 2015


Ah... I see: so a string like this

Peter is visiting Kauai from Scotland. He says "It's a great 
day...Finally I get a break from coding and get to leave this island in 
the northern hinterland and go to another one in the Pacific Blue."

1) first we escape the single quote "It\'s"
2) then wrap with single quotes. and the double quotes are preserved

"sweet"

I'll try it



Peter TB Brett wrote:
> No, single quotes and double quotes are not equivalent in LiveCode. 
> However, the shell ignores any escape characters or " characters 
> inside single-quoted strings.
>
> So, you can do:
>
> replace "'" with "\'" in tBody
> put merge("echo '[[tBody]]' | ") into tCmd
>
> and your tBody should be protected from shell expansion.
>
>                                     Peter 





More information about the use-livecode mailing list