如何计数NSArray中的重复值? [英] How to count duplicates values in NSArray?
本文介绍了如何计数NSArray中的重复值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的 NSArray
的值包含重复项。
我找到重复的,但现在我怎么找到没有。他们重复?
Value of my NSArray
includes the duplicates.
I find the duplicates but now how can I find the no. they repeat?
推荐答案
您可以使用 NSCountedSet
为此。将所有对象添加到计数集,然后使用 countForObject:
方法来查找每个对象出现的频率。
You can use NSCountedSet
for this. Add all your objects to a counted set, then use the countForObject:
method to find out how often each object appears.
这篇关于如何计数NSArray中的重复值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文