Whatever message this page gives is out now! Go check it out!
ListPrepend(list, value [, delimiters, includeEmptyFields ])Parameter | Description |
list | A list or a variable that contains one. |
value | An element or a list of elements. |
delimiters | A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion only uses the first character and ignores the others. |
includeEmptyFields | Boolean to determine to include empty fields from the list that is prepended to the list. |
<cfscript>
myList="Tokyo,Bangkok,Jakarta,Manila,Bangalore,Shanghai";
myAppend=ListPrepend(myList,"Singapore");
WriteOutput(myAppend); // Inserts Singapore at the beginning of the list
</cfscript><cfscript>
mylist="John,Paul,George"
writeOutput(ListPrepend(list=mylist,value=",,,Ringo,,",delimiter=",",includeEmptyFields="true"))
</cfscript><cfscript>
mylist="Paul,George"
writeOutput(ListPrepend(list=mylist,value=",,John,,,Ringo,,",delimiter=",",includeEmptyFields="true"))
</cfscript><cfscript>
mylist="John,Paul,George"
writeOutput(ListPrepend(list=mylist,value=",,,Ringo,,",delimiter=",",includeEmptyFields="false"))
</cfscript><cfscript>
mylist="Paul,George"
writeOutput(ListPrepend(list=mylist,value=",,John,,,Ringo,,",delimiter=",",includeEmptyFields="false"))
</cfscript><cfscript>
mylist="Paul,George"
writeOutput(mylist.ListPrepend(",,John,,,Ringo,,",",","false"))
</cfscript>