listReplace: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 25: | Line 25: | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: | [h: StringVar="This, is, a, great, test"] | ||
[h: List=listReplace( | [h: List=listReplace(StringVar, 3, "silly")] | ||
[r: | [r: StringVar] | ||
</source> | </source> | ||
Returns: This, is, a, poor, test | Returns: This, is, a, poor, test | ||
}} | }} | ||
[[Category:String List Function]] | [[Category:String List Function]] |
Revision as of 23:16, 29 June 2009
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)
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
[h: StringVar="This, is, a, great, test"]
[h: List=listReplace(StringVar, 3, "silly")]
[r: StringVar]