gpt4 book ai didi

javascript - if(字符串.包含(字符串))。那可能吗?

转载 作者:行者123 更新时间:2023-11-28 11:19:22 27 4
gpt4 key购买 nike

我正在尝试检查一个字符串是否包含在另一个字符串中。后面的代码非常简单。我怎样才能在 jquery 中做到这一点?

function deleteRow(locName, locID) {
if(locName.Contains(locID)) {
alert("success");
}
}

最佳答案

使用String.prototype.indexOf

例如:(locName.indexOf(locID) > -1)

String.prototype.contains 不存在。

关于javascript - if(字符串.包含(字符串))。那可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4829023/

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