The upcomming FUI framework needs strong string formatters to bind parameters on labels for instance. Using the sprintf syntax is easy and very powerful in that case. Just imagine you can format and bind your parametes with labels in one easy step like fui.connect( 'label', new Formatter( 'Volume: %.2f\nBPM: % 4i', volume, bpm ) );. Fantástico!
By the way. There is already a great ActionScript 3 version of sprintf out there developed by Manish Jethani. Our version follows the specs a little bit closer (e.g. not displaying 0 for 0-precision integers), supports more specifiers (eEgG) , the asterisk for width/precision and we have type length plus nice error reporting (if you are not familiar with the syntax).
So that as a side-node — FUI is getting closer.




For e, E, and f specifiers, isn’t the precision supposed to specify the number of digits to be printed after the decimal point? That was my understanding from the C++ spec. The class currently uses precision to specify the total number of integers (eg: so 4.99 formatted under $%.2f looks like $5.0, when it should really look like $4.99…)
Is there a different spec that you followed for this?
float 1.0f with %.2f should format to 1.00 — otherwise it is wrong. It could be that I fixed this a while ago. But it is quiet simple if you dig into the code and search for yourself.