Nodejs String Contains onlyContains(stringSet)

Here you can find the source of onlyContains(stringSet)

Method Source Code

String.prototype.onlyContains = function(stringSet) {
   for (var i=0;i<this.length;i++) {
      var currentChar = this[i];
      if (!stringSet.contains(currentChar))
         return false;
   }/*  w  w w.java 2  s.c  o  m*/
   return true;
};

Related

  1. contains(txt)
    String.prototype.contains = function(txt)
        return (this.indexOf(txt) >= 0);
    
  2. contains(value)
    String.prototype.contains = function (value) {
        "use strict";
        var containsValue = false;
        if (this.indexOf(value) >= 0) {
            containsValue = true;
        return containsValue;
    };
    
  3. containsAll(strings, index)
    String.prototype.containsAll = function(strings, index) {
      if(!Array.isArray(strings)) throw Error('1 argument is not an array');
      return strings.every(string => this.includes(string, index), this);
    
  4. contains(substring)
    String.prototype.contains = function contains(substring) {
      return this.indexOf(substring) !== -1;
    };
    
  5. contains(value)
    String.prototype.contains = function contains(value){
      return this.indexOf(value) !== -1;
    };
    
  6. shuffle(container)
    String.prototype.shuffle = function(container){
      var str = this,
        progress = str.length - 2,
        timer = setInterval(function() {
          container.text(str.substring(0, progress++));
          if (progress > str.length) clearInterval(timer);
        }, 80);