ListPrepend
Filters a delimted list and returns the values from the callback test
Method Signature
ListPrepend(list=[string], value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])
Arguments
Argument
Type
Required
Description
Default
list
string
true
string list to filter entries from
value
string
true
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
true
Examples
Prepend to a List using the List member function
seinfeldList = "Close Talker,Soup Nazi";
seinfeldList = seinfeldList.listPrepend( "Puffy Shirt" );
writeOutput( seinfeldList );
Result: "Puffy Shirt,Close Talker,Soup Nazi"
Prepend to a List using a dash delimiter
someList = "1-2-3-4";
someList = listPrepend( someList, "0", "-" );
writeOutput( someList );
Result: "0-1-2-3-4"
Prepend to a List with Empty Fields On
CF2018+
someList = "Feb,Mar,Apr";
someList = listPrepend( someList, ",,Jan", ",", true );
writeOutput( someList );
Result: ",,Jan,Feb,Mar,Apr"
Prepend to a List with Empty Fields Off
CF2018+
someList = "Feb,Mar,Apr";
someList = listPrepend( someList, ",,Jan,,", ",", false );
writeOutput( someList );
Result: "Jan,Feb,Mar,Apr"
Additional Examples
// Simple Example
writeoutput( listPrepend( "Susi,LAS,,boxlang,,,test", "Inserted" ) );
// Member Function
strList = ",I,,love,boxlang,,";
writeDump( strList.listPrepend( "First" ) );
Related
Last updated
Was this helpful?