ListSetAt

Retrieves an item in to a delimited list at the specified position

Method Signature

ListSetAt(list=[string], position=[integer], value=[string], 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

value

string

true

string the value to set at the specified position

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

Replaces the 2nd list element with 'foo'

Run Example

listSetAt( "bar,lorem,ipsum", 2, "foo" );

Result: bar,foo,ipsum

Example with Custom Delimiter

Inserts 'foo' into the list with a custom delimiter

Run Example

Result: bar|foo|me|something

Additional Examples

Run Example

Last updated

Was this helpful?