首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何根据空手道中的酸碱表来计算列表中的重复值

如何根据空手道中的酸碱表来计算列表中的重复值
EN

Stack Overflow用户
提问于 2022-11-12 11:55:31
回答 1查看 25关注 0票数 1

我正在计算列表中重复的值。

代码语言:javascript
复制
[
  "Cloud Services - Hybrid and Azure",
  "Cloud Services - Hybrid and Azure",
  "Cloud Services - Hybrid and Azure",
  "Cloud Services - Hybrid and Azure",
  "Application Development",
  "Application Development",
  "Application Development",
  "CAB Approval"
]

我希望输出是“混合和Azure”=4

代码语言:javascript
复制
karate.distinct() throws error. any help on this is much appreciated.

I tried to take unique values : 

  • json群=新的

代码语言:javascript
复制
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-11-12 12:15:40

只需使用JS数组操作,要简单得多:

代码语言:javascript
复制
* def result = data.filter(x => x == 'Application Development')
* assert result.length == 3
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74412715

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档