You are here: Recent News » Projects » ActionStep » ActionStep Features » Arrays

 

Arrays

The NSArray class is the most commonly used collection class used in ActionStep. It provides methods to query, modify, sort and filter a collection of objects. It is a big step up from ActionScript’s native Array class.

NSArray is inherently similar to Array, but has a whole load of additional features that Array lacks.

This page lists what they are.

Please note that from now on, “lists” will refer to instances of NSArray.

Filtering with Predicates

For more information on what predicates are, please see: Predicates FAQ.

You can get a filtered array using:

var arr:NSArray = myArray.filteredArrayUsingPredicate(myPredicate);

Conversely, you can remove all items except for items that match the predicate, using:

myArray.filterUsingPredicate(myPredicate);

Using Ranges

NSArray allows you to use instances of NSRange . This comes in handy, for example, when you want to remove all null items within a range for a list:

//assume myArray has 10 items
myArray.removeObjectInRange(null, new NSRange(2, 5);

projects/actionstep/documentation/arrays.txt · Last modified: 2007/02/19 11:16 by niko