listReplace: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function listReplace== Replaces the element at the specified index of a Macros:string list with a new value. If a delimiter is not specified then the default value of ',' is used. ...)
 
No edit summary
Line 16: Line 16:


<source lang="mtmacro" line>
<source lang="mtmacro" line>
[r: listInsert("This: isnt: a: test", 1, "is", ":")]  
[r: listReplace("This: isnt: a: test", 1, "is", ":")]  
</source>
</source>
Returns This: is: a: test
Returns This: is: a: test

Revision as of 10:28, 13 December 2008

Function listReplace

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

[h: newList = listReplace(list, index, value)]
[h: newList = listReplace(list, index, value, delim)]

Example

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

Returns This, is, a, Test

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

Returns This: is: a: test