Previous Index Next

BridgePlus.framework, SMSForder Class Methods

Category

List manipulation methods

Method

indexesOfItem:inArray:inverting:

Summary

Returns list of indexes where item is found; inverting true returns indexes where the item is not found. Indexes are zero-based.

Signature

+ (NSArray *)indexesOfItem:(id)theItem inArray:(NSArray *)listOrArray inverting:(BOOL)invertFlag

Parameters

theItem = the item to find

listOrArray = a list or array

invertFlag = whether to list the matching item 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

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

ASify from theResult

--> {1, 3, 5}

theResult as list

--> {1, 3, 5}

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

ASify from theResult

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

theResult as list

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


Click here to open script in a script editor