Nodejs Array Union getUnionAttrStr(filed,split)

Here you can find the source of getUnionAttrStr(filed,split)

Method Source Code

Array.prototype.getUnionAttrStr=function(filed,split){
   //if(!(filed instanceof String))return "";
   try{//w w w . j a va2  s  .  co  m
   //if(!filed.isString())return "";
   var unionStr=new String();
   if(!split){
      split=",";
   }
   for(var i=0;i<this.length;i++){
      var tempVal=this[i][filed];
      //if(!tempVal.isString())continue;
      unionStr+=tempVal+split;
   }
      unionStr=unionStr.substr(0,unionStr.lastIndexOf(split));
   return unionStr;
   }catch(ex){alert(ex);}
}


Array.prototype.getUnionStr = function(split) {
    //if(!(filed instanceof String))return "";
    try {
        //if(!filed.isString())return "";
        var unionStr = new String();
        if (!split) {
            split = ",";
        }
        for (var i = 0; i < this.length; i++) {
            var tempVal = this[i].toString();
            //if(!tempVal.isString())continue;
            unionStr += tempVal + split;
        }
        unionStr = unionStr.substr(0, unionStr.lastIndexOf(split));
        return unionStr;
    } catch (ex) { alert(ex); }
}

Related

  1. union(arr)
    Array.prototype.union = function (arr) {
      return this.concat(arr).distinct();
    };
    
  2. union(ary)
    Array.prototype.union = function (ary) {
        return this.concat(ary).distinct();
    };
    
  3. union(b)
    Array.prototype.union = function(b) {
      return this.concat(b).uniquelize();
    };
    
  4. union(other)
    Array.prototype.union = function (other) {
      var hash = {};
      for (var i = 0; i < this.length; i++) {
        hash[this[i]] = true;
      for (var j = 0; j < other.length; j++) {
        hash[other[j]] = true;
      return Object.keys(hash);
    ...
    
  5. union(t)
    Array.prototype.union = function(t)
        return this.concat(t).unique();
    
  6. getUnionAttrStr(filed,split)
    Array.prototype.getUnionAttrStr=function(filed,split){
      try{
      var unionStr=new String();
      if(!split){
        split=Toyz4js["cfg"]["array_separator"];
      for(var i=0;i<this.length;i++){
        var tempVal=this[i][filed];
        unionStr+=tempVal+split;
    ...
    
  7. getUnionStr(filed,split)
    Array.prototype.getUnionStr=function(filed,split){
      try{
      var unionStr=new String();
      if(!split){
        split=",";
      for(var i=0;i<this.length;i++){
        var tempVal=this[i][filed];
        unionStr+=tempVal+split;
    ...