如何查找重复数据存在于字典数组中。 [英] How to find duplicate data is present in array of dictionary.
问题描述
我有字典数组。如果字典数组中存在重复数据,那么将使用重复的元素名称引发一个标记。
字典数组如下:
[[project_code:1,lob:lob_1],[project_code:1,lob:lob_1],[project_code:2,lob:lob_1],[project_code:3,lob:lob_1]]
这里我们需要循环查找相同的project_code和lob是否相同,然后它将返回所有重复的project_code。
重复数据意味着project_code和lob值对应相同。
在上面的数组中,如果我们通过那么它应该返回project_code: 1
如果有人可以在Swift中编写代码..
先谢谢。
I have array of dictionary. If duplicate data is present in the array of dictionary then a flag to be raised with the element name which is duplicate.
The array of dictionary is below:
[[project_code: 1, lob: lob_1], [project_code: 1, lob: lob_1], [project_code: 2, lob: lob_1], [project_code: 3, lob: lob_1]]
Here we need to loop through and find if same project_code and lob is same, then it would return which all project_code which are duplicate.
Duplicate data means the pair of project_code and lob value should be same.
In the above array, if we go through then it should return project_code : 1
If anyone can write a code in Swift ..
Thanks in Advance.
推荐答案
请检查以下链接
http: //stackoverflow.com/questions/29727618/find-duplicate-elements-in-array-using-swift [ ^ ]
Please check following link
http://stackoverflow.com/questions/29727618/find-duplicate-elements-in-array-using-swift[^]
这篇关于如何查找重复数据存在于字典数组中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!