ListGetAt
Retrieves an item from a delimited list at the specified position
Method Signature
ListGetAt(list=[string], position=[integer], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])
Arguments
Argument
Type
Required
Description
Default
list
string
true
string list to filter entries from
position
integer
true
numeric the one-based index position to retrieve the value at
delimiter
string
false
string the list delimiter
,
includeEmptyFields
boolean
false
boolean whether to include empty fields in the returned result
false
multiCharacterDelimiter
boolean
false
boolean whether the delimiter is multi-character
false
Examples
Simple Example
Returns the 2nd element in the list
listGetAt( "foo,bar,lorem,ipsum", 2 );
Result: bar
Example with Delimiter
Returns the 3rd element in the list using a custom delimiter
listGetAt( "foo,bar|lorem,ipsum|me|something", 3, "|" );
Result: me
Example with IncludeEmptyValues
Returns the 4th element in the list, treating the empty element as a value
listGetAt( "foo,bar,,lorem,ipsum", 4, ",", true );
Result: lorem
Additional Examples
writeOutput( listGetAt( "a,,b,c,", 3, ",", true ) ); // Returns b
// Member Function with '/' delimiter
strList = "/a//b/c//d";
writeDump( strList.listGetAt( 5, "/", true ) );
// Expected output c
Related
Last updated
Was this helpful?