Cuis-Automatically escape a complex string: Difference between revisions
Jump to navigation
Jump to search
(importe material) |
(added link) |
||
Line 14: | Line 14: | ||
* Voila<nowiki>', you have your string automatically escaped, notice the doulbe $' character in i''</nowiki>m nicola. |
* Voila<nowiki>', you have your string automatically escaped, notice the doulbe $' character in i''</nowiki>m nicola. |
||
* Some time ago I made a video tutorial about this with a much worst string. There the procedure is a bit different, it was specific for Squeak. |
* Some time ago I made a [https://youtu.be/clJIJnQ5vQ4 video tutorial] about this with a much worst string. There the procedure is a bit different, it was specific for Squeak. |
||
----Dr. Nicola Mingotti firt wrote this on 21-Sep-2021. Tested in Cuis5.0-4834.image |
----Dr. Nicola Mingotti firt wrote this on 21-Sep-2021. Tested in Cuis5.0-4834.image |
Revision as of 23:36, 3 May 2025
Problem You have a long shell command, or an SQL command, or something else which may contain tne $'
Character. You can escape the $'
by doubling it yourself but it will become quite hard to read your original string. Is there a better way?
Solution. Yes, there is a nice trick to achieve that.
- Suppose the string you want to quote is
echo "i'm nicola, who are you?"
- Open a TextMorph
te _ TextEditor openTextEditor .
- Write the string into it
- Go back to the Workspace and type this
te model actualContents asString . => 'echo "hello, i''m nicola, who are you?"'
- Voila', you have your string automatically escaped, notice the doulbe $' character in i''m nicola.
- Some time ago I made a video tutorial about this with a much worst string. There the procedure is a bit different, it was specific for Squeak.
Dr. Nicola Mingotti firt wrote this on 21-Sep-2021. Tested in Cuis5.0-4834.image