links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
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.


'I want {1} apples' format: #(3).
=> 'I want 3 apples'

The arguments must be supplied as a Collection, Here I supplied an array.


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