/ Published in: ActionScript
Expand |
Embed | Plain Text
Array.prototype._find = function(str,matchCase,dive) { /* * This returns the index of a find in an array * Note: Finds only ONE EXACT occurrence. Use _findAll for all occurrences. */ var ary_length = this.length; if(typeof(str)!="string") matchCase = true; for (var i:Number=0;i < ary_length; ++i) { if( matchCase == true ){ if( dive ) { if( this[i][dive] == str ) return i; }else{ if( this[i] == str ) return i; } }else{ var strL = str.toLowerCase(); if( dive ) { if( this[i][dive].toLowerCase() == strL ) return i; }else{ if( this[i].toLowerCase() == strL.toLowerCase() ) return i; } } } return false; }// End Function
You need to login to post a comment.
