How do you printf and sprintf in Io?
How can I:
- convert an object to a string without printing it, a la Python's str(obj)?
- print using percent (%) directives a la C's printf(format, obj1, obj2, ...)?
- create a string using percent (%) directive开发者_运维问答s without printing to stdout a la C's sprintf(str, fmt, obj1, obj2, ...)?
Interpolation:
"2 + 2 = #{4}" interpolate
Concatenation:
"2 + 2 = " .. 4 asString
Interpolation with printing:
"2 + 2 = #{4}" interpolate println
Concatenation with printing:
("2 + 2 = " .. 4 asString) println
精彩评论