listGet: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Janky edit giving a warning on bugged behavior.)
mNo edit summary
Line 10: Line 10:
[r: listGet(a,3," ")]
[r: listGet(a,3," ")]
</source>
</source>
Output is 5, when is should be 4 because of the 2 SPACE characters counting as 1.
Output is 5, when it should be 4 because of the 2 SPACE characters counting as 1.


|usage=
|usage=

Revision as of 15:32, 2 January 2022

listGet() Function

Introduced in version 1.3b42
Returns the value in the string list at the specified index. The index for a string list starts at 0.

Known Bug: If you use a whitespace character like a SPACE or TAB, listGet will pull the wrong indexed value.

[H: a = "1 2  4 5"]
[r: listGet(a,3," ")]
Output is 5, when it should be 4 because of the 2 SPACE characters counting as 1.

Usage

listGet(list, index)
listGet(list, index, delim)

If delim is not specified then the default value of ',' is used as the value separator in the string list

Example

[r: listGet("This, is, a , test", 2)]

Returns a

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