AppendArrayToArrayfunction
Appends one array to another array.
Parameters
| Name | Description | |
|---|---|---|
rg | The array. | |
rg2 | The array to append. |
Description
Appends a one-dimensional array to another dynamic one-dimensional array.
Remarks
The array and the array to append can be of any type, but they have to be of the same type between them.
If the array has a fixed length, GetLastError will return an E_ACCESSDENIED error.
Examples
#macro AppendArrayToArray(rg, rg2)
#define XSTRING DWSTRING ' // or STRING, BSTRING, etc. DIM rg(ANY) AS XSTRING DIM rg2(ANY) AS XSTRING DIM xStr AS XSTRING = "String - " ' // Fill the array FOR i AS LONG = 1 TO 10 AppendElementToArray(rg, xStr & WSTR(i)) NEXT ' Fill the array to append xStr = "String 2 - " FOR i AS LONG = 1 TO 5 AppendElementToArray(rg2, xStr & WSTR(i)) NEXT ' // Append the array to the first array AppendArrayToArray(rg, rg2) ' // Display the array FOR i AS LONG = LBOUND(rg) TO UBOUND(rg) print rg(i) NEXT
DIM rg(ANY) AS LONG DIM rg2(ANY) AS LONG ' // Fill the array DIM nLong AS LONG = 1 FOR i AS LONG = 1 TO 10 AppendElementToArray(rg, nLong) nLong += 1 NEXT ' Fill the array to insert nLong = 12345 FOR i AS LONG = 1 TO 5 AppendElementToArray(rg2, nLong) nLong += 1 NEXT AppendArrayToArray(rg, rg2) ' // Display the array FOR i AS LONG = LBOUND(rg) TO UBOUND(rg) print rg(i) NEXT
Reference
- Include file
AfxArrays.inc - Documented in String Management/Array Macros.md
- Topic: Array Macros