From: "i.v.r." Date: 2005-11-02T07:09:44+09:00 Subject: Re: Newbie: How to format a number to always show two decimals? mental@rydia.net wrote: > Quoting "i.v.r." : > > >> 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. > > -mental > > > Ah, I see. I'm actually very familiar with the second approach, so that's what I always use. So don't worry, no kittens will die by my hand :-) - Ivan