10 examples of 'jquery if string contains' in JavaScript

Every line of 'jquery if string contains' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
4function stringContains(string, value) {
5 return string.indexOf(value) !== -1
6}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

132function stringContains(string1, string2)
133{
134 return string1.indexOf(string2) == 1;
135}
40value: function contains(string, needle) {
41 var search = string.match(needle);
42 return search && search.length > 0;
43}
70function strContains(x, s){
71 const xl = x.toLowerCase();
72 const sl = s.toLowerCase();
73 return xl.indexOf(sl) >= 0;
74}
14export default function contains(str: string, searchStr: string): boolean {
15 return str.indexOf(searchStr) !== -1;
16}
278function contains(haystack, needle) {
279 return haystack.toLowerCase().indexOf(needle.toLowerCase()) != -1;
280}
15public static contains(haystack: string, needle: string): boolean {
16 if (!haystack) {
17 return false;
18 }
19 return haystack.indexOf(needle) >= 0;
20}
137export function contains(text: string, substring: string): boolean {
138 return text.indexOf(substring) > -1;
139}
265function contains(property, query) {
266 return property && property.toLowerCase().indexOf(query.toLowerCase()) !== -1;
267}
10function contains(str, substr) {
11 return (str.indexOf(substr) > -1);
12}

Related snippets