title: Truncate a value in JSON script
body: <p>I'm creating a stock widget, using JSON to get data from the Yahoo API/YQL console. I am using values from the key ChangePercentRealtime, but the values are longer than I need. How can I truncate the value down to the portion I need, which is the latter percentage? I have no idea how to accomplish this, and a Google search hasn't turned anything useful up.</p>
  
  <p>Here is what I've got so far: <a href="http://jsfiddle.net/thetuneupguy/r2Bca/" rel="nofollow">http://jsfiddle.net/thetuneupguy/r2Bca/</a></p>
  
  <pre><code>$(function () {
      $.getJSON('http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20yahoo.finance.quotes%20WHERE%20symbol%20in(%22GCF14.CMX%22%2C%22SIF14.CMX%22%2C%22PAH14.NYM%22%2C%22PLF14.NYM%22)&amp;format=json&amp;diagnostics=true&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&amp;callback=', function (data) {
      console.log("data: ", data);
      console.log(data.query.results.quote);
      $.each(data.query.results.quote, function (key, obj) {
          var changeClass = '';
          var changeInPercentClass = '';
          var $tr = $('&lt;tr/&gt;', {
              'class': 'my-new-list'
          }).appendTo('#blk-1 table');
          $tr.append($('&lt;td/&gt;').text(obj.Name || "--"));
          $tr.append($('&lt;td/&gt;').text(obj.AskRealtime || "--"));
          $tr.append($('&lt;td/&gt;').text(obj.BidRealtime || "--"));
  
          (obj.Change.substr(0,1) == '+') ? changeClass = 'green' : changeClass = 'red';
  
          (obj.Change.substr(0,1) == '+') ? changeInPercentClass = 'green' : changeInPercentClass = 'red';
  
          $tr.append($('&lt;td class="'+changeClass+'"&gt;').text(obj.ChangeRealtime|| "--"));
          $tr.append($('&lt;td class="'+changeInPercentClass+'"&gt;').text(obj.ChangePercentRealtime || "--"));
          });
  
      });
  });
  </code></pre>