/ Published in: JavaScript
                    
                                        
This is a script [tweeted by @gregmuellegger](http://twitter.com/gregmuellegger/status/16618146398). Example usage: Supports f("Hello %s.", ["World"]) and f("Hello %(name)s.", {name: "World"})
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function (s, dict) {
var i = 0;
return s.replace(/%(?:\(([^)]+)\))?[diouxXeEfFgGcrs]/g, function (dummy, v) { return dict[v || i++]; });
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                