listReplace: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Performed an UNDO of the template tag deletion by the previous edit.)
m (Conversion script moved page listReplace to ListReplace without leaving a redirect: Converting page title to first-letter uppercase)
(No difference)

Revision as of 22:19, 9 February 2023

listReplace() Function

Introduced in version 1.3b42
Replaces the element at the specified index of a String List with a new value. If a delimiter is not specified then the default value of "," is used. The index for lists starts at 0.

Usage

listReplace(list, index, value)
listReplace(list, index, value, delim)

Examples

Simple example:
[r: listReplace("This, isnt, a , test", 1, "is")]

Returns This, is, a, Test

Example using a String List with a non-default delimiter:

[r: listReplace("This: isnt: a: test", 1, "is", ":")]

Returns This: is: a: test

Example using a String List stored in a variable:

[h: ListVar = "This, is, a, great, test"]
[h: ListVar = listReplace(ListVar, 3, "silly")]
[r: ListVar]
Returns: This, is, a, silly, test