10 examples of 'jquery contains string' in JavaScript

Every line of 'jquery contains string' 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
4function stringContains(string, value) {
5 return string.indexOf(value) !== -1
6}
14export default function contains(str: string, searchStr: string): boolean {
15 return str.indexOf(searchStr) !== -1;
16}
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}
15function inArray( array, str ) {
16 var i;
17 if ( array.indexOf ) {
18 return array.indexOf( str ) > -1;
19 } else {
20 for ( i = 0; i < array.length; i++ ) {
21 if ( str === array[i] ) {
22 return true;
23 }
24 }
25 return false;
26 }
27}
70function strContains(x, s){
71 const xl = x.toLowerCase();
72 const sl = s.toLowerCase();
73 return xl.indexOf(sl) >= 0;
74}
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}
10function contains(str, substr) {
11 return (str.indexOf(substr) > -1);
12}

Related snippets