|
Append
None Append(Property var, Value value)
|
Adds the given value to the end of the array property var. value can be any
expression that evaluates to a string, double, Boolean, or the value of another
property. |
Resize(A, 0);
Append(A, 'Apple');
Append(A, 'Cherry');
Append(A, 'Dutch');
The property A is an array of three strings,
"Apple", "Cherry", and
"Dutch".
|
|
ArrayGetDimensions
Array ArrayGetDimensions(Array values)
|
Determines the dimensions on an input array as an array of dimension sizes.
This format is useful to pass to the ArrayResize function to create
an array with matching dimensions. |
#dims := ArrayGetDimensions(oldArray);
|
|
ArrayNumColumns
Number ArrayNumColumns(Array2D values)
|
Returns the size of the second dimension of an array. |
Resize(arr, 24, 16);
#numColumns := ArrayNumColumns(arr);
The local property numColumns will be set to
16.
|
|
ArrayNumDimensions
Number ArrayNumDimensions(Array values)
|
Gets the number of dimensions of an array property. One for simple arrays, two
for 2-dimensional arrays, 3 for 3-dimensional arrays, etc. |
Resize(arr, 24, 16, 3);
#numDim := ArrayNumDimensions(arr);
The local property numDim will be set to 3.
|
|
ArrayNumRows
Number ArrayNumRows(Array2D values)
|
Returns the size of the first dimension of an array. |
Resize(arr, 24, 16);
#numRows := ArrayNumRows(arr);
The local property numRows will be set to
24.
|
|
ArrayNumValues
Number ArrayNumValues(Array values)
|
Returns the total number of elements in an array. For arrays of more than one
dimension, this returns the product of the dimension sizes. |
Resize(arr, 24, 16);
#numElements := ArrayNumValues(arr);
The local property numElements will be set to
384.
|
|
ArrayResize
None ArrayResize(Array arr, Array dimensions)
|
Coerces the property arr into an array having the dimensions specified by
dimensions. The first element in each dimension has index 1. New elements in the
vector are not initialized. |
#dims := ArrayGetDimensions(oldArray);
ArrayResize(newArray, #dims);
ArrayResize() behaves the same as the Resize()
function for single-dimensional arrays. For multi-dimensional arrays, the two
functions behave differently. ArrayResize() takes the dimension
sizes as a single array parameter, whereas Resize() varies the
size of the parameter list so that each dimension size gets its own parameter.
ArrayResize() is useful in conjunction with
ArrayGetDimensions(), which returns the array dimensions as a
parameter.
|
|
Contract
None Contract(String char, Property var[, ...])
|
Takes a character and one or more array properties. For each property, it uses
the character as a separator and appends together all the array values into a single
string. The original array-based property value is replaced by that single string
value. (This function is the opposite of Expand.) |
A := 'Apple; Cherry; Dutch';
Expand(';', A);
Contract('-', A);
Results in the property A having a single string value of
"Apple-Cherry-Dutch".
|
|
Expand
None Expand(String char, Property var[, ...])
|
Takes a character and one or more array properties. The property is taken as a
string, and the character is used as a separator to convert the string into an
array, with the elements containing the separated values. If the string contains
multiple characters, any of those characters can act as a breaking character. The
separated strings are trimmed of white space at the end.
If Expand encounters quotation marks, all enclosed text is
treated as a single string, and any enclosed delimiters are ignored. For example,
the string [one two "three four five" six], expanded with the
space character, contains four items, not six, and the double quotes are removed
from the third item.
|
A := 'Steriod;Estrogen-Antagonist;Dopaminergic';
Expand(';', A);
Results in the property A having three separate string values of
"Steriod", "Estrogen-Antagonist", and
"Dopaminergic".
|
|
InsertValue
None InsertValue(Array var, Value value, Number index)
|
Inserts the given value at the given index, resizing the array to one larger,
and pushing the value at the index and all higher values, up one index. (The first
item in the array has index 1.) |
Resize(A, 0);
Append(A, 'Apple');
Append(A, 'Dutch');
InsertValue(A, 'Cherry', 2);
At the end, the property A is an array of three strings,
"Apple", "Cherry", and
"Dutch".
|
|
NumberSort
None NumberSort(Array var)
|
Numerically sorts an array property var in ascending order. |
A[1] := 1;
A[2] := 3;
A[3] := 2;
NumberSort(A);
Results in A[1], A[2], and
A[3] having the values 1, 2,
and 3, respectively. Following a call to
NumberSort, any non-numeric values in the array are changed to
zeros .
|
|
NumValues
Number NumValues(Array arr|Property var)
|
Returns the dimension of the array property var or the Array arr. Most scalars
return 1. The null value returns 0. |
resize(@a, 3);
@a[1] := 1;
@a[2] := 2;
@a[3] := 3;
x := 0;
FOR #i IN 1 ..
numvalues(@a)
LOOP
x := x + @a[#i];
END LOOP;
Results in x containing the sum of the values in array
a.
For a global variable, refer to defined but not initialized parameter,
NumValues() returns 1. For a defined global
variable, it returns zero.
|
|
RemoveDuplicates
None RemoveDuplicates(Array var)
|
Removes duplicate elements from an array property var, shrinking the size of
the array. String comparisons are case sensitive, so strings that differ only in
letter case are deemed different. No type conversions are done. For example, the
number 10 and the string "10" are
different. |
A[1] := 'Aardvark';
A[2] := 'Coyote';
A[3] := 'Hamster';
A[4] := 'Aardvark';
A[5] := 'Bassett Hound';
A[6] := 'Hamster';
REMOVEDUPLICATES(A);
Results in A[1], A[2], A[3],
and A[4] having the string values 'Aardvark',
'Coyote', and 'Hamster', and 'Bassett
Hound', respectively. The array is resized to four elements.
|
|
RemoveValue
None RemoveValue(Array var, Number index)
|
Removes the value at the given index, resizing the array to one smaller, and
decrementing the index of all values with higher indices. |
Resize(A, 0);
Append(A, 'Apple');
Append(A, 'Cherry');
Append(A, 'Dutch');
RemoveValue(A, 2);
At the end, the property A is an array of two strings,
"Apple" and "Dutch".
|
|
Resize
None Resize(Array var, Number n[, Number dim2, ...)
|
Coerces the property var to a vector with n elements. The first vector element
has index 1. New elements in the vector are not initialized. |
Resize(a, 10);
Resize() behaves the same as the ArrayResize()
function for single-dimensional arrays. For multi-dimensional arrays, the two
functions behave differently. The ArrayResize() takes the
dimension sizes as a single array parameter, whereas Resize()
varies the size of the parameter list, so that each dimension size gets its own
parameter.
ArrayResize() is useful in conjunction with
ArrayGetDimensions(), which returns the array dimensions as a
parameter.
|
|
Sort
None Sort(Array var)
|
Sorts the elements in an array property var in ascending order. (String
comparisons are case-sensitive.) |
A[1] := 'Bark';
A[2] := 'Woof';
A[3] := 'Arf';
Sort(A);
Results in A[1], A[2], and
A[3] having the values "Arf",
"Bark", "Woof", respectively.
|
|
SortN
None SortN(Array var, Array arg1 [, ...])
|
Sorts the elements in an array property key in ascending order. (String
comparisons are case sensitive.) Additional arguments must be array properties with
the same length as the key property; their values are sorted so that they remain
aligned with the sorted values of the key property. |
Name[1] := 'Sue';
Phone[1] := '555-1234';
Name[2] := 'Anne';
Phone[2] := '555-5678';
Name[3] := 'Terese';
Phone[3] := '555-9012';
SORTN(Name, Phone);
Results in Name[1], Name[2], and
Name[3] having the values "Anne",
"Sue", and "Terese", respectively.
Phone[1], Phone[2], and
Phone[3] have the values "555-5678",
"555-1234", and "555-9012", respectively.
|