You can use javascript’s indexOf function.
var str1 = "ABCDEFGHIJKLMNOP";
var str2 = "DEFG";
if(str1.indexOf(str2) != -1){
console.log(str2 + " found");
}
More Related Contents:
- How do I check if string contains substring? [duplicate]
- Escaping HTML strings with jQuery
- How to check if a string contains text from an array of substrings in JavaScript?
- Switch statement for greater-than/less-than
- Why is string “11” less than string “3”? [duplicate]
- How to find if an array contains a specific string in JavaScript/jQuery?
- Optimum way to compare strings in JavaScript? [duplicate]
- Remove whitespace and line breaks between HTML elements using jQuery
- How can I use jQuery to style /parts/ of all instances of a specific word?
- How can val() return Number?
- Wrap tags around http text
- Convert javascript array to string
- Split a string based on multiple delimiters
- How to trim() white spaces from a string?
- Insert space before capital letters
- Format a JavaScript string using placeholders and an object of substitutions?
- jQuery call function from a string [duplicate]
- How Can I Truncate A String In jQuery?
- Remove occurrences of duplicate words in a string
- Compare Strings Javascript Return %of Likely
- Javascript / Jquery – Get number from string
- How to test if a URL string is absolute or relative?
- Put quotes around a variable string in JavaScript
- How to check if a string is a legal “dd/mm/yyyy” date?
- Anagrams finder in javascript
- How to get text between two characters?
- Wildcard string comparison in Javascript
- Find and replace nth occurrence of [bracketed] expression in string
- Does jQuery strip some html elements from a string when using .html()?
- Count immediate child div elements using jQuery