Return to Snippet

Revision: 8965
at October 15, 2008 11:38 by tonic


Initial Code
// NEEDS MOOTOOLS 1.2 FRAMEWORK

Array.prototype.find = function(searchStr) {
  var returnArray = [];
  this.each(function(objeto,index){
     if (objeto.contains(searchStr)) {
        returnArray.push(objeto);
        alert('hay uno');
      }
  });
  return returnArray;
}

Initial URL

                                

Initial Description
You can find a string as an array row value.
Ex:
arr=['abcde','mdleo']
arr.find('dbd') -> array['abcde']
arr.find('akdowewo') -> array[] (empty)

Initial Title
Find string in array as value in mootools

Initial Tags
search, array, find

Initial Language
JavaScript