code: function (chunks, start, end) {
      var soff=0, eoff=0, i=0, j=0;
      for (i=0; i<chunks.length; i++) {
        if (soff + chunks[i].length > start)
          break;
        soff += chunks[i].length;
      }
      var strs = [];
      eoff = soff;
      for (j=i; j<chunks.length; j++) {
        strs.push(chunks[j]);
        if (eoff + chunks[j].length > end)
          break;
        eoff += chunks[j].length;
      }
      var s = strs.join('');
      return s.substring(start-soff, start-soff+(end-start));
    }
docs: extract substring from an array of strings