0%
一维数组
空数组
1 2 3
| local array Of any &arr1 = createArray(); local array &arr1 = createArray();
|
1 2 3 4 5 6 7 8 9
| local array Of string &arr1 = CreateArrayRept("",0);
local array Of string &arr1 = CreateArrayRept("zc",3);
|
1 2 3 4 5 6 7 8 9
| local array of number &arr1 = CreateArrayRept(0,0);
local array of number &arr1 = CreateArrayRept(2,3);
|
1 2
| Local Array of Record &AR = createAyyayRpt(&rec, 0);
|
非空数组
1 2
| local array of string &arr1 = CreateArray("X",123);
|
1 2
| local array of number &arr1 = CreateArray(123,234,345);
|
1 2
| local array of record &arr1 = CreateArray(&rec1,&rec2,&rec3);
|
二维数组
空数组
1 2 3
| local array of array of any &arr2 = CreateArray(CreateArray()); &arr2.shift();
|
1 2
| local array of array of string &arr2 = CreateArrayRept(CreateArrayRept("", 0), 0);
|
1 2
| local array of array of string &arr2 = CreateArrayRept(CreateArrayRept(0, 0), 0);
|
非空数组
1 2
| local array of array of any &arr2 = CreateArray(CreateArray());
|
1 2
| local array of array of string &arr2 = CreateArray(CreateArray("",0));
|
1 2
| local array of array of number &arr2 = CreateArray(CreateArray(0,0));
|
数组常用函数
1 2
| &arr1 = CreateArrayRept(100, 3);
|
1 2
| local Array of Any &ArrayAny = CreateArrayAny(1, 2, "hi", "there");
|
1 2 3
| &arr = createArray("a","b","c"); &arr.push("z");
|
1 2 3 4 5 6
| &arr = createArray("a","b","c");
local number &indx = &arr.find("a"); --&indx = 1;
|
1 2 3 4 5
| &arr = createArray("a","b","c");
local string &itname = &arr.get(1); --&itname = "a";
|
1 2 3 4 5 6 7
| Local array of array of number &AAN;
&AAN = CreateArray(CreateArray(1, 2), CreateArray(3, 4), 5); &STR = &AAN.Join(", ");
|
1 2 3 4
| &arr = createArray("a","b","c"); local string &str = &arr.shift();
|
1 2 3 4 5
| &A = CreateArray("a", "B", "c"); &A.Unshift("x", "Y");
|
1 2 3 4
| &arr = createArray("a","b","c"); local string &str = &arr.pop();
|
1 2 3 4 5 6 7
| Local Array of Array of String &AAN, &AAN2;
&AAN = CreateArray(CreateArray("A", "B"), CreateArray("C", "D"), "E"); &AAN2 = &AAN.Clone(); &AAN2[1][1] = "Z";
|
1 2 3 4 5 6 7
| Local array of string &arr1 = CreateArray("a", "s", "d", "f"); &index = 0; While &arr1.Next(&index) MessageBox(0, "", 0, 0, &arr1 [&index]); End-While;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Local array of string &AS; &AS = CreateArray("AA", "BB", "CC"); &AS.Replace(1, 1, "ZZ", "YY");
&AS.Replace(2, 2, "MM");
&AS.Replace( - 2, - 1, "OO");
|
1 2 3
| &AN = CreateArray(CreateArray(1, 2), CreateArray(3, 4), CreateArray(5, 6)).reverse();
|
1 2 3 4
| . &MyArray[8] = &MyValue; &MyArray.Set(8) = &MyValue;
|
1 2 3 4
| &A = CreateArray("John", "Frank", "Harry"); &A.Sort("A");
|
1 2 3 4 5 6 7 8 9
| &A = CreateArray("John", "Frank", "Harry"); &AAN = &A.Subarray(2, 2);
|
1 2 3 4 5 6 7 8 9 10 11
| &A = CreateArray(); &A[1] = "John"; &A[2] = "Jane"; &A[3] = "Henry"; &A.Substitute("Henry", "Hamilton");
|