String formatting with format:: Difference between revisions

From Cuis CookBook
Jump to navigation Jump to search
(importe material)
 
No edit summary
 
Line 1: Line 1:
* Most of the time you will want your string to be dynamic, that is, part of their contents must depend on the result of evaluating code.
* Most of the time you will want your string to be dynamic, that is, part of their contents must depend on the result of evaluating code.
<syntaxhighlight lang="smalltalk">

'this is value {1} and this is value {2}' format: #('foo' 123). "=> 'this is value foo and this is value 123' "
'this is value {1} and this is value {2}' format: #('foo' 123). "=> 'this is value foo and this is value 123' "
</syntaxhighlight>

Latest revision as of 22:33, 4 May 2025

  • Most of the time you will want your string to be dynamic, that is, part of their contents must depend on the result of evaluating code.
'this is value {1} and this is value {2}' format: #('foo' 123).    "=> 'this is value foo and this is value 123' "