My method receives a String argument.
That String represents source code, which can contain another string.
The problem is that now I want to have a quoted string inside a quoted string, and the compiler doesn't accept it.
obj mymethod:
'mymethod: arg
Transcript show: 'code to make noise';cr. "This is the method code"
'.
How can I write string inside a string (i.e., how can I include a string quote character '
inside a string) ?
You have to escape single quote in string with another single quote. So you have to do:
obj mymethod:
'mymethod: arg
Transcript show: ''code to make noise'';cr. "This is the method code"
'.