sprintf() and printf() in JavaScript

WARNING! This code from 2003-ish is hideously outdated and should be avoided at all costs. Also, it looks like it was formatted by a turnip on drugs.

One of the most useful functions of any programming language is formatting strings. This function seemed to be lacking a bit in JavaScript, so I wrote an early implementation. I follow the same format as PHP's sprintf() function.

If you want printf() functionality, do a document.write(sprintf(...)); call.

Please note that is not finished yet! There are a lot of things to be done, including but not limited to: