ItemReplace

Replaces an item in a list.

Syntax:

ItemReplace (item, index, list, delimiter)

Parameters:

(s) item replacement item.

(i) index the position in list of the item to be replaced.

(s) list a string containing a list of items.

(s) delimiter a character to act as a delimiter between items in the list.

Returns:

(s) new list, with item replaced.

 

This function replaces an item in a list with a new item. It returns a new list, with the specified replacement made; the original list ("list") is unchanged. For example, specifying an index of 1 causes the first item in the list to be replaced with the new item ("item").

Note: Using -1 as the index will replace the last item in the list

A single item null list ("") is not a valid list.

Example:


list="apples pears oranges grapes"
index=ItemLocate("oranges", list, " ")
newlist = ItemReplace("tangerine", index, list, " ")
Message("List after item is replaced", newlist)
See Also:

ItemCount, ItemCountCsv, ItemExtract, ItemExtractCsv, ItemInsert, ItemLocate, ItemLocateWild, ItemRemove, ItemSort, Lists Explained