Heya, guys--

Converting a Ruby program to Pharo, and one of the things this program does
is write a file out by date. The format is "yyyymmdd" (which is my
preferred naming convention). In Ruby I have:

"%04d" % d.year + "%02d" % d.month + "%02d" % d.day

In Smalltalk, the closest I can seem to get to this is:

d year asString, (d monthIndex asString padLeftTo: 2 with: $0), (d
dayOfMonth asString padLeftTo: 2 with: $0)

...which seems sort verbose. Anyone have any more elegant solutions?

Reply via email to