开发者

Check if the inputted string contains something on my list

开发者 https://www.devze.com 2023-01-11 23:48 出处:网络
Let\'s say i input \"i love you\". If you have type开发者_JS百科d a statement that contains a \"love\" word then it will do something.Try:

Let's say i input "i love you". If you have type开发者_JS百科d a statement that contains a "love" word then it will do something.


Try:

List<String> keywords = // your words
for (String key : keywords) {
    if (yourPhrase.contains(key)) {
        // do something
    }
}

It should do the job.

0

精彩评论

暂无评论...
验证码 换一张
取 消