Returns a copy of the array object.
1 array.clone
<array.clone name='name'>
<array /> ?
</array.clone>
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 can be passed as an argument of the function. |
Returns | |
---|---|
Type | Description |
array | Returns an array object copy of the origin array. |
Example
Clone the array.
Copy
<xsql-script name='array_clone'> <body> <array name='cities'> <string>Barcelona</string> <string>Paris</string> <null /> <string>Roma</string> <null /> </array> <set name='cities_clone'> <array.clone name='cities' /> </set> <!-- element at position 3: Roma --> <println>element at position 3: <array.get name='cities_clone'><number>3</number></array.get></println> <!-- Delete the nulls of the clone objects, the original object remains as it is. --> <array.clearNulls name='cities_clone' /> <!-- size : 5 --> <println>size : <array.size name='cities' /></println> <!-- size clone: 3 --> <println>size clone: <array.size name='cities_clone' /></println> </body> </xsql-script>
The result is:
Copy
element at position 3: Roma size : 5 size clone: 3