Find Unique Characters in a File

前端 未结 22 2715
耶瑟儿~
耶瑟儿~ 2021-02-04 03:30

I have a file with 450,000+ rows of entries. Each entry is about 7 characters in length. What I want to know is the unique characters of this file.

For instance, if my f

22条回答
  •  我寻月下人不归
    2021-02-04 04:05

    Try this file with JSDB Javascript (includes the javascript engine in the Firefox browser):

    var seenAlreadyMap={};
    var seenAlreadyArray=[];
    while (!system.stdin.eof)
    {
      var L = system.stdin.readLine();
      for (var i = L.length; i-- > 0; )
      {
        var c = L[i].toLowerCase();
        if (!(c in seenAlreadyMap))
        {
          seenAlreadyMap[c] = true;
          seenAlreadyArray.push(c);
        }
      }
    }
    system.stdout.writeln(seenAlreadyArray.sort().join(''));
    

提交回复
热议问题