listInsert: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added version.)
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 6: Line 6:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
listInsert(list, index, value)
listInsert(list, index, value)
</source>
</syntaxhighlight>
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
listInsert(list, index, value, delim)
listInsert(list, index, value, delim)
</source>
</syntaxhighlight>


|example=
|example=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: listInsert("This, a , test", 1, "is")]
[r: listInsert("This, a , test", 1, "is")]
</source>
</syntaxhighlight>
Returns This, is, a, Test
Returns This, is, a, Test


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: listInsert("This: a: test", 1, "is", ":")]  
[r: listInsert("This: a: test", 1, "is", ":")]  
</source>
</syntaxhighlight>
Returns This: is: a: test
Returns This: is: a: test
}}
}}
[[Category:String List Function]]
[[Category:String List Function]]

Latest revision as of 20:08, 15 March 2023

listInsert() Function

Introduced in version 1.3b42
Inserts a value into the string list at the specified index. If a delimiter is not specified then the default value of ',' is used. The index for lists starts at 0

Usage

listInsert(list, index, value)
listInsert(list, index, value, delim)

Example

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

Returns This, is, a, Test

[r: listInsert("This: a: test", 1, "is", ":")]
Returns This: is: a: test