Nodejs Utililty Methods String Contains

List of utility methods to do String Contains

Description

The list of methods to do String Contains are organized into topic(s).

Method

contains(search)
String.prototype.contains = function (search) {
    if (!search) {
        return false;
    return this.indexOf(search) != -1;
};
contains(search)
String.prototype.contains = function(search)
  return this.toLowerCase().indexOf(search.toLowerCase()) !== -1;
};
contains(searchFor)
String.prototype.contains = function (searchFor) {
    return String.prototype.indexOf.call(this, String(searchFor)) !== -1;
};
contains(searchString)
String.prototype.contains = function(searchString){
    return (this.indexOf(searchString) != -1);
};
contains(searchString)
String.prototype.contains = function (searchString) {
  return !!~this.indexOf(searchString);
};
contains(str)
String.prototype.contains = function(str) {      
  return this.indexOf(str) != -1;
};
module.exports = {
  isNullOrEmpty: function(str){
    return str == null || str == '';
};
contains(str)
String.prototype.contains = function(str) {
  return this.indexOf(str) > -1;
};
contains(str)
String.prototype.contains = function(str) {
    return this.indexOf(str) !== -1;
};
contains(str)
String.prototype.contains = function(str) {
    if (typeof str !== 'string') return false;
    return this.indexOf(str) !== -1;
};
contains(str)
String.prototype.contains = function(str) {
  return this.toLowerCase().indexOf(str.toLowerCase()) > -1;
};