- @if (0)==(0) echo off
- cscript //nologo //e:jscript "%~f0" < a.txt
- pause & exit
- @end
-
- var i = 0, arr = [], max = [];
- var reg = /[^\x00-\xff]/g;
-
- while(!WSH.StdIn.AtEndOfStream){
- var strLine = WSH.StdIn.ReadLine();
- if(!/^\s*$/.test(strLine)) {
- arr[i] = strLine.split('||');
- for(var j=0; j<arr[i].length; j++) {
- var len = arr[i][j].replace(reg, '..').length;
- if(!max[j] || len > max[j]) max[j] = len;
- }
- i++;
- }
- }
-
- for(var i=0; i<arr.length; i++) {
- var s = '';
- for(var j=0; j<arr[i].length; j++) {
- var len = max[j] - arr[i][j].replace(reg, '..').length;
- var space = ' ';
- for (var k=0; k<len; k++) space += ' ';
- s += arr[i][j] + space;
- }
- WScript.Echo(s);
- }
复制代码
|