ListDeleteAt
Deletes an element from a list.
Returns a copy of the list, without the specified element.
Method Signature
ListDeleteAt(list=[string], position=[integer], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])
Arguments
Argument
Type
Required
Description
Default
list
string
true
The list to delete from.
position
integer
true
The one-based index position of the element to delete.
delimiter
string
false
The delimiter used in the list.
,
includeEmptyFields
boolean
false
Whether to include empty fields in the list.
false
multiCharacterDelimiter
boolean
false
Whether the delimiter is a multi-character delimiter.
false
Examples
Simple Example
Deletes 2nd item from the list
listDeleteAt( "foo,bar,lorem,ipsum", 2 );
Result: foo,lorem,ipsum
Example with Custom Delimiter
Deletes 2nd item from the list using a custom delimiter
listDeleteAt( "foo,bar|lorem,ipsum|me|something", 2, "|" );
Result: foo,bar|me|something
Additional Examples
writeOutput( listDeleteAt( "I,love,boxlang,testFile", 4 ) ); // Expected output I,love,boxlang
// Member Function
strList = "This,is,a,the,test,file";
writeDump( strList.listDeleteAt( 3 ) );
// Expected output This,is,the,test,file
Related
Last updated
Was this helpful?