Adds an item to a list.
ItemInsert (item, index, list, delimiter)
(s) item a new item to add to list.
(i) index the position in list after which the item will be inserted.
(s) list a string containing a list of items.
(s) delimiter a character to act as a delimiter between items in the list.
(s) new list, with item inserted.
This function inserts a new item into an existing list, at the position following index. It returns a new list, with the specified item inserted; the original list (list) is unchanged. For example, specifying an index of 1 causes the new item to be inserted after the first item in the list; i.e., the new item becomes the second item in the list.
You can specify an index of 0 to add the item to the beginning of the list, and an index of -1 to append the item to the end of the list.
Note: trailing delimiters are significant. This means that if you specify a blank item ("") and an offset of -1, a blank item will be added to the end of the list, even if the list already has a trailing delimiter.
item="apricots" list="apples pears oranges grapes" newlist = ItemInsert(item, -1, list, " ") Message("List after ItemInsert", newlist)
ItemCount, ItemCountCsv, ItemExtract, ItemExtractCsv, ItemLocate, ItemLocateWild, ItemRemove, ItemReplace, ItemSort, Lists Explained