/ Published in: JavaScript
A simple Javascript function to determine if one string contains another.
Usage:
if (myString.contains("anything") {
do something…
}
Usage:
if (myString.contains("anything") {
do something…
}
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if (typeof String.prototype.contains != 'function') { String.prototype.contains = function(str) { return this.indexOf(str) >= 0; }; }