ArrayFind

Array finders and contains functions with and without case sensitivity.

Please note that "contain" methods return a boolean, while "find" methods return an index. If you use a function as the value, it will be used as a search closure or lambda. The signature of the function should be:


    ( value, index ) => {
 	  	return true; // if the value is found, else false
   }
 

Example:


   array = [ 1, 2, 3, 4, 5 ];
  index = array.find( ( value, index ) -> {
 		return value == 3;
 } );
 

We recommend you use BoxLang lambdas ( {@code ->} ) for this purpose, so they only act upon the value and index without any side effects. They will be faster and more efficient.

Method Signature

ArrayFind(array=[array], value=[any], substringMatch=[boolean])

Arguments

Examples

Last updated

Logo

Copyright & Register Trademark by Ortus Solutions, Corp & Ortus Software, LLC