I can't remember why I needed this but I've made a JavaScript version as close to the real one as possible, I added 2 parameters
b = boolean value
B = Binary value (supports %010B etc)
Code:
function zxPrintf( text )
{
    var arg = arguments, a = 0,
		i, c, b = false, r = '', pad, v, j, pc, pa, ptxt, app = false;
	if ( !text || text === null )
		{ return ""; }
	for ( i = 0; i < text.length; ++i )
	{
		c = text[ i ];
        if ( app )
		{
            if ( pad )
			{
                pa = (+ptxt) - v.length;
				for ( j = 0; j < pa; ++j )
					{ r += pc; }
			}
			r += v;
			b = false;
			continue;
		}
		if ( b )
		{
			switch ( c )
			{
			case '0': case ' ':
				if ( !pad )
				{
					pc = c;
					pad = true;
				}
				else
					{ ptxt += c; }
				break;
			case '1': case '2':
			case '3': case '4':
			case '5': case '6':
			case '7': case '8':
			case '9':
				if ( pad )
					{ ptxt += c; }
				break;
			case 'd': case 'i': case 'f':
				v = arg[ ++a ].toString();
				app = true;
				break;
			case 's':
				v = arg[ ++a ];
				app = true;
				break;
			case 'b':
				pad = false;
				v = ( arg[ ++a ] && arg[ a ] !== null ) ? 'true' : 'false';
				app = true;
				break;
    		case 'B':
				v = arg[ ++a ].toString( 2 );
				app = true;
				break;
    		case 'x': case 'X':
				v = arg[ ++a ].toString( 16 );
				if ( c === 'x' )
					{ v = v.toLowerCase(); }
				else
					{ v = v.toUpperCase(); }
				app = true;
				break;
			default:
				b = false;
			}
			continue;
		}
		if ( c === '%' )
		{
			if ( text[ i + 1 ] === '%' )
			{
				r += '%';
				++i;
				continue;
			}
			b = true;
			pad = false;
			ptxt = '0';
			app = false;
			continue;
		}
		r += c;
	}
    if ( app )
	{
        if ( pad )
		{
            pa = (+ptxt) - v.length;
			for ( j = 0; j < pa; ++j )
				{ r += pc; }
		}
		r += v;
	}
	return r;
}
If something is missing then please post about it, I may take a while to check back but I at least want to know if there is something wrong with my code.