Lasso Soft Inc. > Home

[Array->FindIndex]

[Array->FindIndex] searches the array for the parameter and returns an array of indices for those elements which match. Accepts a single parameter of any data type.

If the array contains any pair values, only the first part of the pair is compared with the parameter of the [Array->FindIndex] tag.

If no elements in the array match the parameter to the [Array->FindIndex] tag then an empty array is returned.

  • Syntax
  • Parameters
[Array->(FindIndex: 'Find Value')]
Required Parameters
Array The array which is to be searched.
Find Value The value to find in the array.
Examples

To find the index of a certain value within an array:

Use the [Array->FindIndex] tag. This tag can be used to locate the index of a particular value within an array so that element can be deleted or changed. In the following example the index for the item Blue is found and the value of that element is changed to Aqua.

[Variable: 'myArray' = (Array: 'Red', 'Green', 'Blue', 'Orange')]
[Variable: 'myIndex' = $myArray->(FindIndex: 'Blue')->(Get:1)]
[$myArray->(Get: $myIndex) = 'Aqua']
[Output: $myArray]
Result:
(Array: (Red), (Green), (Aqua), (Orange))
Tag Link [Array->FindIndex] Category Array
Type Member Data Source Any
Support Preferred Version 6.0
Output Type Array Security None
Implementation Internal Sets Lasso 6.0

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft