Returns list with value assigned to its element at specified position.
See also ListDeleteAt, ListGetAt, and ListInsertAt.
ListSetAt(list, position, value [, delimiters ])
Any list.
Any position. The first position in a list is denoted by the number 1, not 0.
Any value.
Set of delimiters.
When assigning an element to a list, ColdFusion needs to insert a delimiter. If delimiters contain more than one delimiter, ColdFusion defaults to the first delimiter in the string, or, (comma) if delimiters was omitted.
If you intend to use list functions on strings that are delimited by the conjunction ", " (comma-space), as is common in HTTP header strings such as the COOKIE header, we recommend that you specify delimiters to include both comma and space because ColdFusion Server does not skip white space.
<!--- This example shows ListSetAt ---> <HTML> <HEAD> <TITLE>ListSetAt Example</TITLE> </HEAD> <BASEFONT FACE="Arial, Helvetica" SIZE=2> <BODY bgcolor="#FFFFD5"> <H3>ListSetAt Example</H3> <!--- Find a list of users who wrote messages ---> <CFQUERY NAME="GetMessageUser" DATASOURCE="cfexpress"> SELECT Subject, Posted FROM Messages </CFQUERY> <CFSET temp = ValueList(GetMessageUser.Subject)> <!--- loop through the list and show it with ListGetAt ---> <H3>This is a list of <CFOUTPUT>#ListLen(temp)#</CFOUTPUT> subjects posted in messages.</H3> <CFSET ChangedItem = ListGetAt(temp, 2, ",")> <CFSET TempToo = ListSetAt(temp, 2, "I changed this subject", ",")> <UL> <CFLOOP FROM="1" TO="#ListLen(temptoo)#" INDEX="Counter"> <CFOUTPUT><LI>(#Counter#) SUBJECT: #ListGetAt(temptoo, Counter)#</ CFOUTPUT> </CFLOOP> </UL> <P>Note that item 2, "<CFOUTPUT>#changedItem#</CFOUTPUT>", has been altered to "I changed this subject" using ListSetAt. </BODY> </HTML>