Hi -- On Wed, 2 Nov 2005, mental / rydia.net wrote: > Quoting "i.v.r." <ivanvega / gmail.com>: > >> What's wrong with sprintf? I don't see how sprintf is evil versus >> the long procedure you detailed, but what do I know... I'm just a >> BASIC programmer, LOL. > > There's nothing wrong with using sprintf (aka format) here. It's > just not the most readable or flexible solution in many other > cases. > > Since sprintf() is lifted almost directly from C, recent converts > from C do have a tendency to overuse it. That and its distinctly > C-ish flavor likely account for Harold's revulsion. > > Now, not being a former C programmer, you may not be so strongly > tempted to write: > > sprintf("%s%s%s", a.zolum, b.fep, c.gorza) > > when you could have simply written: > > "#{a.zolum}#{b.fep}#{c.gorza}" > > ...but if you ever are, please be aware that it's worth TWO kittens. I think one of the common rites of passage into Ruby is going from this: printf("%s\n", string); to this: puts string :-) Mind you, as a scanf author I do root for that family of methods a bit. scanf, when conditions allow its use, can actually save you a lot of .to_i-ing and such. David -- David A. Black dblack / wobblini.net