Nodejs String Contains contains(substring, ignoreCase)

Here you can find the source of contains(substring, ignoreCase)

Method Source Code

// String Additions
String.prototype.contains = function(substring, ignoreCase) {
  var lowerSubString = substring.toLowerCase(),
  lowerThis = this.toLowerCase();// www .jav a2s.co  m
  if (ignoreCase) {
    return lowerThis.indexOf(lowerSubString) > -1;
  } else {
    return this.indexOf(substring) > -1;
  }
}

Related

  1. 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);
    
  2. contains(subString)
    String.prototype.contains = function (subString) {
      return this.indexOf(subString) !== -1;
    };
    
  3. contains(substr)
    String.prototype.contains = function(substr)
      return this.indexOf(substr) > -1;
    
  4. contains(substring)
    String.prototype.contains = function(substring) {
      return !!this.match(new RegExp(substring, 'i'));
    
  5. contains(substring)
    String.prototype.contains = function(substring) {
      return this.indexOf(substring) != -1;
    
  6. contains(t)
    String.prototype.contains = function (t) {
        return this.indexOf(t) != -1;
    };
    
  7. contains(term)
    String.prototype.contains = function(term){
      return this.indexOf(term) > -1;
    };
    
  8. contains(text)
    String.prototype.contains = function (text) {
        return this.toLowerCase().indexOf(text.toLowerCase()) !== -1;
    };
    
  9. contains(token, ignoreCase)
    String.prototype.contains = function(token, ignoreCase) {
      var _reg = 0, str = this.toString(), i;
      if(str && typeof token === "string") {
        if(ignoreCase === true) {
          token = token.toLowerCase();
          str = str.toLowerCase();
        while((i = str.indexOf(token)) !== -1) {
          str = str.substring(i + token.length);
    ...