title: format string in javascript
body: <p>Is it possible to achieve this in javascript?</p>
  
  <p>Here is the format:</p>
  
  <pre><code>1 ITEM1      9.00   0%  9.00
  1 ITEM-GET01 8.00   12% 5.00
  </code></pre>
  
  <p>I would like to create a receipt like layout. I'm using backbone.js so there will be models and collection involve.</p>
  
  <p>Also if it were on a table can I use jquery to get the data from the table <code>tr</code> then have the result just like what is posted above?</p>
  
  <p>I was able to read about sprintf but I don't think it it is the one I need. any ideas?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I'm trying out sprintf here is what i've come so far</p>
  
  <pre><code>var result = sprintf("%d %-s %.2f %d%% %.2f", model.get("Qty"), model.get("Itemname"), model.get("Price"), model.get("Discount"), model.get("ExtPrice"));
  </code></pre>
  
  <p>result is:</p>
  
  <pre><code>1 Item1 1.49 0% 1.49
  </code></pre>