Format String Literal Syntax
Opened this issue · 3 comments
pcperini commented
Feature request to circumvent (String stringWithFormat: 'Hello %@%s', 'World', "!")
:
Declaring strings from formats should be as easy as:
formattedString := 'Hello %@%s': 'World', "!" // format, ...
// or
formattedString := ('Hello %@%s': 'World', "!") // (format, ...)
fabiopelosin commented
What about string interpolation?
formattedString := 'Hello #{'World'}!'
orta commented
string interpolation is better than a format string IMO
pcperini commented
might be a bit weird syntactically though. i like how python does it, so maybe something like:
world := 'World'
formattedString := 'Hello %world' // automatic interpolation from variables
// or
formattedString := 'Hello %world': {'world': world} // explicit interpolation from key/val pairs