inArray&安培;字符串 [英] inArray & in string

查看:83
本文介绍了inArray&安培;字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检查一个字符串是否在数组的数组中的任何项目的字符串的一部分。
可以说,在数组中的项目之一是Hello World的和字符串是ELLO,我需​​要返回true。

i need to check if a string is in array as part of a string of any item in the array. Lets say one of the items in the array is "Hello World" and the string is "ello", I need that to return true.

推荐答案

是的,你可以做到这一切。或者 -

Yeah, you could do all that. Or-

if(String(array).indexOf('ello')!=-1){
     ello is in the array
}

这篇关于inArray&安培;字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆