gpt4 book ai didi

flutter - Dart :在列表中搜索值

转载 作者:行者123 更新时间:2023-12-03 04:32:03 28 4
gpt4 key购买 nike

有了下一个列表,如何通过uno搜索(例如un)来获得contains3
enter image description here

最佳答案

您可以使用any运算符来实现

var contains1 = array.any((item)=>item.contains("un"));
print(contains1);// true

any : Checks every element in iteration order, and returns true if any of them make test return true, otherwise returns false.

关于flutter - Dart :在列表中搜索值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64774907/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com