|
5 | 5 | "member":"someArray.len()", |
6 | 6 | "returns":"numeric", |
7 | 7 | "related":["arrayAvg"], |
8 | | - "description":"Determines the number of elements in an array.\n CF MX: this function can be used on child XML objects.", |
| 8 | + "description":"Determines the largest index in an array.\nFor dense arrays, this corresponds to the number of elements in the array.\n CF MX: this function can be used on child XML objects.", |
9 | 9 | "params": [ |
10 | | - {"name":"array","description":"An array which to determine length","required":true,"default":"","type":"array","values":[]} |
| 10 | + {"name":"array","description":"An array from which to get the final index.","required":true,"default":"","type":"array","values":[]} |
11 | 11 | ], |
12 | 12 | "engines": { |
13 | 13 | "coldfusion": {"minimum_version":"3", "notes":"The member function cannot be called on literals", "docs":"https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arraylen.html"}, |
|
23 | 23 | ], |
24 | 24 | "examples": [ |
25 | 25 | { |
26 | | - "title": "Simple example for arrayLen function", |
27 | | - "description": "Uses the arrayLen function to get the total length of an array", |
| 26 | + "title": "Using arrayLen to get the length of a dense array", |
| 27 | + "description": "Uses the arrayLen function to get the total length of a dense array", |
28 | 28 | "code": "numberArray = [1,2,3,4];\nwriteOutput(arrayLen(numberArray));", |
29 | 29 | "result": "4" |
30 | 30 | }, |
31 | 31 | { |
32 | | - "title": "Total length of an array using the member function", |
33 | | - "description": "CF11+ Lucee4.5+ Uses the len member function is the same as running arrayLen.", |
| 32 | + "title": "Using member function to get the length of a dense array", |
| 33 | + "description": "CF11+ Lucee4.5+ Using the len member function is the same as running arrayLen.", |
34 | 34 | "code": "colorArray = ['Green','red','blue'];\nwriteOutput(colorArray.len());", |
35 | 35 | "result": "3" |
| 36 | + }, |
| 37 | + { |
| 38 | + "title": "Using arrayLen on a sparse array", |
| 39 | + "description": "Uses the arrayLen function to get the largest index of a spare array", |
| 40 | + "code": "sparseArray = [];\nsparseArray[42] = 42;\nwriteOutput(arrayLen(sparseArray));", |
| 41 | + "result": "42" |
36 | 42 | } |
37 | 43 | ] |
38 | 44 | } |
0 commit comments