Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 有没有办法找出一组数组中一个元素的计数_Swift - Fatal编程技术网

Swift 有没有办法找出一组数组中一个元素的计数

Swift 有没有办法找出一组数组中一个元素的计数,swift,Swift,我有一系列关于患者的信息。我想知道数组中一个元素出现的次数 我是Swift和iOS开发新手,非常感谢您的帮助。您可以使用筛选功能,然后计算剩余阵列的数量 array.filter({$0==item}).count 使用lazy。否则,这将是无效的。

我有一系列关于患者的信息。我想知道数组中一个元素出现的次数


我是Swift和iOS开发新手,非常感谢您的帮助。

您可以使用
筛选功能,然后计算剩余阵列的数量

array.filter({$0==item}).count

使用
lazy
。否则,这将是无效的。