Cuis-String escape: Difference between revisions

From Cuis CookBook
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 2: Line 2:
<syntaxhighlight lang="smalltalk">
<syntaxhighlight lang="smalltalk">
'hello \n world' "=> 'hello \n world' "
'hello \n world' "=> 'hello \n world' "
</syntaxhighlight>
</syntaxhighlight>


* So, if you want to insert a $' inside a string you must just type it twice
* So, if you want to insert a $' inside a string you must just type it twice

Latest revision as of 22:26, 4 May 2025

  • The only special character in CuisSmalltalk strings is $'. This is quite unusual, Let's check for example \n means nothing to it.
'hello \n world' "=> 'hello \n world' "
  • So, if you want to insert a $' inside a string you must just type it twice
'hey it''s me!' .    "=> 'hey it''s me!' "

Hey, you may say, the $' appears twice, that's not what i want! True, but let's what it is really inside the string looking at their characters we see how things really are:

'hey it''s me!' asArray . "=> #($h $e $y $ $i $t $' $s $ $m $e $!) "