<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > BuiltIn Functions > Array functions > ARRAY EXTRACT |
Description
Extract from MainArray all elements corresponding to ComparisonTest filling DestinationArray with elements found.
Syntax
nRec = ARRAY EXTRACT MainArray, [COLLATE UCASE,] {StartsWith | EndsWith | Contains} ComparisonStringExpression InTo DestinationArray
Syntax for array of pointer to heap allocated memory areas: each element of MainArray MUST be a DWORD pointer to some memory allocated with HEAP* functions.
nRec = ARRAY EXTRACT MainArray PTR, [COLLATE UCASE,] {StartsWith | EndsWith | Contains} ComparisonStringExpression InTo DestinationArray
Returns
None
Parameters
Name |
Type |
Optional |
Meaning |
MainArray |
Array |
No |
Name of the variable array containing elements to be checked. |
ComparisonStringExpression |
String |
No |
String expression that will be used to compare elements with depending on comparison type: StartsWith, EndsWith, Contains. |
DestinationArray |
Array |
No |
The element index inside the array from which to start assignment. Attention: this array will be automatically free and resized |
Remarks
If COLLATE UCASE will be present, all comparison will take place in upper case format
Restrictions
MainArray and DestinationArray must be dynamic string arrays.
All comparisons are sensible to upper/lower case unless COLLATE UCASE option is present.
See also
LBound, UBound, ARRAY SORT, ARRAY SCAN,
Examples