Class: List
Description
This method adds a value to a list and returns the modified list containing the new value.
Syntax
ListObject.add(String element,String delimiter,
Boolean allowDuplicate,Boolean inOrder)
Parameters
element |
The value to add to the list. |
delimiter |
A character that is used to delimit the values in the list. |
allowDuplicate |
An option that indicates whether duplicate entries are permitted in the list. The default is 1 (allow duplicates). |
inOrder |
An option that indicates whether the element is inserted into the list in ascending order. If inOrder is 1 and the List is not sorted, the result is unpredictable. |
Returns
An updated list.
When Became Available
Profile v7.0
Example
// define a List object with some elements
type List myList = Class.new("List", "AAP:NOOT:MIES")
// define a new list with an element added
// use default duplicates, but try to sort
type List newList = myList.add("NEW",":",,1)
write newList,! // AAP:NOOT:MIES:NEW
// same, but force sorted list to begin with
type List sortList = myList.sort(":").add("NEW",":",,1)
write sortList,! // AAP:MIES:NEW:NOOT