String method format:
Last updated at 7:26 pm UTC on 14 July 2022
People used to C-style languages will find the #format: message useful.
This provides printf() like functionality.
Text also implements this.
Example.1
'I want {1} apples' format: #(3).
=> 'I want 3 apples'
The arguments must be supplied as a Collection, Here I supplied an array.
Example.2
Taken from the String format: method code.
'\{ \} \\ foo {1} bar {2}' format: {12. 'string'}.
=> '{ } \ foo 12 bar string'
See also
String method expandMacrosWith:
STT - Smalltalk Templates