是否有一个 Ruby 函数可以对两组字符串执行异或运算?
我有两个字符串数组,我想找到不在两者交集中的字符串集。我想要的是 MATLAB 中 SETXOR 的等价物: http://www.mathworks.com/help/techdoc/ref/setxor.html
我将术语集与 Array 互换使用。
当然,我可以在形成这个问题的时间内轻松地写出自己的问题,但我认为我应该问。
I have two Arrays of strings, and I would like to find the set of strings not in the intersection of both. The equivalent of SETXOR in MATLAB is what I want:
http://www.mathworks.com/help/techdoc/ref/setxor.html
I'm using the term set interchangeably with Array.
Of course, I could have just as easily written my own in the time taken to form this question, but I thought I should ask.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它比写一个问题更短......
顺便说一下,Ruby 有一个类 Set ,所以最好不要使用这个词作为数组的同义词。
It was shorter, than to write a question...
By the way, Ruby has a class Set, so better not to use this word as a synonym to an Array.
是的,正如纳基隆所说,赛特。
Yes, as Nakilon says, Set.
你总是可以做
You can always just do