Static class wrapping various Array utilities.
static public function insert(a:Array, objElement:Object, nIndex:Number):Array
insert an element into array at a specific index
a | (Array) |
objElement | (Object) |
nIndex | (Number) |
Array
static public function remove(a:Array, objElement:Object):Array
remove all instances of an element from an array
a | (Array) |
objElement | (Object) |
Array
static public function search(a:Array, objElement:Object):Number
search an array for a given element and return its index or null
a | (Array) |
objElement | (Object) |
Number
static public function shuffle(a:Array):Void
shuffle array items
a | (Array) |
Void
static public function clone(a:Array):Array
return a clone of the array
a | (Array) |
Array
static public function merge(aA:Array, aB:Array):Array
merge two arrays into one
aA | (Array) |
aB | (Array) |
Array
static public function swap(a:Array, nA:Number, nB:Number):Array
Swap two elements positions in an array
a | (Array) |
nA | (Number) element A's index |
nB | (Number) element B's index |
Array
Error | on invalid array index |
static public function asort(a:Array):Array
Return alphabetically sorted array.
a | (Array) |
Array
static public function removeDuplicate(a:Array):Array
return array with duplicate entries removed
a | (Array) |
Array
static public function matchValues(aA:Array, aB:Array):Boolean
compare two arrays for a matching value
aA | (Array) |
aB | (Array) |
Boolean
static public function compare(aA:Array, aB:Array):Boolean
compare two arrays to see if they are identical
aA | (Array) |
aB | (Array) |
Boolean
static public function locatePropVal(objArr:Array, prop:String, val:Object, isCaseInsensitive:Boolean):Object
Search for a specific value of a property in an array of objects
objArr | (Array) array of objects |
prop | (String) property to search |
val | (Object) value to locate |
isCaseInsensitive | (Boolean) - define whether prop and val should be case-insensitive [default: false] |
Object - that matches property value
static public function locatePropValIndex(a:Array, prop:String, val:Object):Number
Search for a unique value property match and return its index in the array.
a | (Array) array of objects |
prop | (String) property to search |
val | (Object) value to locate |
Number - index of hit
static public function sliceByPropVal(objArr:Array, prop:String, val:Object, isCaseInsensitive:Boolean):Array
Return a new array sliced from original array based on a value property match
objArr | (Array) array of objects |
prop | (String) property to search |
val | (Object) value to locate |
isCaseInsensitive | (Boolean) - define whether prop and val should be case-insensitive [default: false] |
Array - array of objects that matches property value
static public function min(a:Array):Number
Return the index of the minimum value in a numeric array
a | (Array) |
Number - minimum value
static public function max(a:Array):Number
Return the index of the maximum value in a numeric array
a | (Array) |
Number - maximum value