Previous Index Next

BridgePlus.framework, SMSForder Class Methods

Category

List manipulation methods

Method

indexesOfItems:inArray:inverting:

Summary

Returns list of indexes where any of the items in the list are found; inverting true returns indexes where the items are not found. Indexes are zero-based.

Signature

+ (NSArray *)indexesOfItems:(NSArray *)listOfItems inArray:(NSArray *)listOrArray inverting:(BOOL)invertFlag

Parameters

listOfItems = list of items to find

listOrArray = a list or array

invertFlag = whether to list the matching items’ indexes, or all other indexes

Result

An array of integers

Availability

Version 1.0.0

Notes

 

Sample

use scripting additions

use framework "Foundation"

use script "BridgePlus"

load framework


set listOrArray to {1, 2, 3, 2, 4, 2, 5, 3}

set theItem to {2, 4}

set theResult to current application's SMSForder's indexesOfItems:theItem inArray:listOrArray inverting:false

ASify from theResult

--> {1, 3, 4, 5}

theResult as list

--> {1, 3, 4, 5}

set theResult to current application's SMSForder's indexesOfItems:theItem inArray:listOrArray inverting:true

ASify from theResult

--> {0, 2, 6, 7}

theResult as list

--> {0, 2, 6, 7}


Click here to open script in a script editor