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(string, index)
String.prototype.contains = function (string, index) {
  return this.indexOf(string, index) !== -1;
};
contains(string, index)
String.prototype.contains = function (string, index) {
  return this.indexOf(string, index) !== -1;
};
contains(stringSet)
String.prototype.contains = function(stringSet) {
  for (var i=0;i<stringSet.length;i++) {
     if (this.indexOf(stringSet[i]) >= 0)
        return true;
  return false;
};
contains(strings, index)
String.prototype.contains = function(strings, index) {
  if(!Array.isArray(strings)) throw Error('1 argument is not an array');
  return strings.some(string => this.includes(string, index), this);
contains(subString)
String.prototype.contains = function (subString) {
  return this.indexOf(subString) !== -1;
};
contains(substr)
String.prototype.contains = function(substr)
  return this.indexOf(substr) > -1;
contains(substring)
String.prototype.contains = function(substring) {
  return !!this.match(new RegExp(substring, 'i'));
contains(substring)
String.prototype.contains = function(substring) {
  return this.indexOf(substring) != -1;
contains(substring, ignoreCase)
String.prototype.contains = function(substring, ignoreCase) {
  var lowerSubString = substring.toLowerCase(),
  lowerThis = this.toLowerCase();
  if (ignoreCase) {
    return lowerThis.indexOf(lowerSubString) > -1;
  } else {
    return this.indexOf(substring) > -1;
contains(t)
String.prototype.contains = function (t) {
    return this.indexOf(t) != -1;
};