String.Split() Function mysteriously ignoring duplicates

前端 未结 2 1983
你的背包
你的背包 2020-12-07 06:27

In Unity3D I am reading a textfile with information on nodes and its connections.

However it seems that ALL duplicates are removed automatically!

           


        
2条回答
  •  -上瘾入骨i
    2020-12-07 07:17

    Even though split shouldn't remove duplicates (tested here) you could try using Regex and Linq.

    var words = Regex.Matches("Node,Node2,Node2,Lamp,Lamp,Node1,Node3,Node4", @",?(\w+)").Cast().Select(x => x.Groups[1].Value);
    

提交回复
热议问题