test.js- var map = [];
- var fso = new ActiveXObject('Scripting.FileSystemObject');
-
- var str = fso.OpenTextFile('a.txt').ReadAll().replace(
- /[^\r\n]+/g,
- function(s0){
- if (map[s0]){s0 += '(' + (++map[s0]) + ')'} else map[s0] = 1;
- return s0;
- }
- )
- fso.CreateTextFile('b.txt',2).Write(str)
复制代码
|