タブスライサー
空白トリム
ソース
function execSepBtn_click(){ outDat.value = dat =''; var ket = sepLen.value.split(/[\t,\r\n]/); var nyu = inpDat.value.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n"); for(var k in nyu){ var st=0; if((k == nyu.length-1)&&(nyu[k] =="")) break; for(var i in ket){ var en = st + Number(ket[i]); for(j=st; j<en; j++){ var c = nyu[k].charCodeAt(j); if(0x80 <= c && (c <= 0xff60 || 0xffa0 <= c)) en --; } dat += cutBlank.checked ? (nyu[k].slice(st,en).replace(/^\s*|\s*$/g,'')+" ") : (nyu[k].slice(st,en)+" "); st = en; } dat = dat.replace(/\t$/,"")+"\r\n"; } outDat.value = dat; outDat.select(); $(outDat).toggle().fadeIn(); }