function splitLines(lines, len, sep) {
			   if (!sep) sep = ',';
			   if (!len) len = 100;
			   var nlines = [];
			   for (i in lines) {
			      var line = lines[i];
			      if (line.length > len) {
			         var segs = line.split(sep);
			         for (j in segs) {
			            var seg = segs[j];
			            while (seg.length > len) {
			               var p = Math.round(len * 0.9);
			               var k = p;
			               for (; k < seg.length && seg[k]!=' '; k++);
			               if (k >= seg.length)
			                  break;
			               nlines[nlines.length] = seg.substring(0, k);
			               seg = seg.substring(k);
			            }
			            nlines[nlines.length] = seg;			              
			         }
			      } else
			         nlines[nlines.length]=line;
			   }
			   return nlines;
			}
// Scan all lines and if longer than len, split along separator sep.
Scan all lines and if longer than len, split along separator sep.
Scan all lines and if longer than len split along separator sep .
function splitLines(lines, len, sep) {
			   if (!sep) sep = ',';
			   if (!len) len = 100;
			   var nlines = [];
			   for (i in lines) {
			      var line = lines[i];
			      if (line.length > len) {
			         var segs = line.split(sep);
			         for (j in segs) {
			            var seg = segs[j];
			            while (seg.length > len) {
			               var p = Math.round(len * 0.9);
			               var k = p;
			               for (; k < seg.length && seg[k]!=' '; k++);
			               if (k >= seg.length)
			                  break;
			               nlines[nlines.length] = seg.substring(0, k);
			               seg = seg.substring(k);
			            }
			            nlines[nlines.length] = seg;			              
			         }
			      } else
			         nlines[nlines.length]=line;
			   }
			   return nlines;
			}
function splitLines ( lines , len , sep ) { if ( ! sep ) sep = ',' ; if ( ! len ) len = 100 ; var nlines = [ ] ; for ( i in lines ) { var line = lines [ i ] ; if ( line . length > len ) { var segs = line . split ( sep ) ; for ( j in segs ) { var seg = segs [ j ] ; while ( seg . length > len ) { var p = Math . round ( len * 0.9 ) ; var k = p ; for ( ; k < seg . length && seg [ k ] != ' ' ; k ++ ) ; if ( k >= seg . length ) break ; nlines [ nlines . length ] = seg . substring ( 0 , k ) ; seg = seg . substring ( k ) ; } nlines [ nlines . length ] = seg ; } } else nlines [ nlines . length ] = line ; } return nlines ; }
Scan all lines and if longer than len, split along separator sep.
Scan all lines and if longer than len split along separator sep .