Simulate printf function

Is there a way to create a printf procedure in AI2 ?
Or would it be better done through an extension ?

My thought process seems to be over complicating it.
My thought, build a list of different substitution characters, %1, %2, %s, etc.
Search for those items in the text string, if found, figure the place marker in the text, and replace the text with the corresponding new text, then go to the next item found...

Thank you

You could certainly build such a procedure in your app if you want. It might not be the fastest printf in the world but it's definitely doable. You'd have to think about where the output would go (or implement something more like sprintf and have it return the output as a string). Implementing it as an extension would provide a performance boost, and you could probably even make it a wrapper around Java's String.format method to use the native formatting function.

printf with an extension

Thank you both for your help.
I was just wondering if someone already had it done, so I wouldn't have to try.
Since it would only be for my use, I wouldn't care about speed, etc.

I have a list of errors, I wanted to use it with. But, it would probably be easier to "variable" the error from the php return code, rather than have AI2 do it.

Thanks everyone !