Whatever message this page gives is out now! Go check it out!
ListSetAt(list, position, value [, delimiters, includeEmptyValues ])Parameter | Description |
includeEmptyValues | Optional. Set to yes to include empty values. |
list | A list or a variable that contains one. |
position | A positive integer or a variable that contains one. Position at which to set a value. The first list position is 1. |
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 processes each occurrence of each character as a delimiter. |
<cfscript>
// case 1
myList="Hulk,Superman,Batman,Joker"
// replace Joker with Aquaman at position 4
setAt=ListSetAt(myList,4,"Aquaman")
writeOutput(setAt & "<br/>")
// case 2: using a delimiter
myList1="England|Spain|Germany|France"
// replace Spain with Portugal at position 2
setAt1=ListSetAt(myList1,2,"Portugal","|")
writeOutput(setAt1)
</cfscript>