Restore the number of elements of a variable of array type.
1 array.size
<array.size name='name'>
<array /> ?
</array.size>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aname | string | Name of the variable of array type. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Earray | array | The array object can be referenced by name using the attribute name or it can be passed as an argument of the function. |
Returns | |
---|---|
Type | Description |
Integer | Restore the size of the list, the quantity of elements which contains. |
Example
Number of the elements of an array.
Copy
<xsql-script name='array_size_test1'> <body> <array name='cities'> <string>Barcelona</string> <string>Paris</string> <string>Rome</string> </array> <println><array.size name='cities' /></println> </body> </xsql-script>
An alternative to obtain the number of cities which contains the variable, less elegant but equally valid, would be:
Copy
<array.size><cities/></array.size>
The result is:
Copy
3