Remove the last element of a variable of array type.
1 array.removeLast
<array.removeLast name='name'>
<array /> ?
</array.removeLast>
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 |
Object | The object which has been removed from the list. |
Example
Remove the last element from an array.
Copy
<xsql-script name='array_removeLast_test1'> <body> <array name='cities'> <string>Barcelona</string> <string>Paris</string> <string>Rome</string> </array> <array.removeLast name='cities' /> <println><cities /></println> </body> </xsql-script>
The last element of the structure, which is 'Rome' will be removed. Another way to remove the last string, would be:
Copy
<array.removeLast/><ciudades/></array.removeLast>
The result is:
Copy
Barcelona Paris