Macromedia coldfusion 4.5-cfml language reference User Manual

Page of 608
426
CFML Language Reference 
ListSetAt
Returns list with value assigned to its element at specified position.
See also 
ListDeleteAt
ListGetAt
, and 
ListInsertAt
.
Syntax
ListSetAt(
list, position, value [, delimiters ])
list
Any list.
position
Any position. The first position in a list is denoted by the number 1, not 0.
value
Any value.
delimiters
Set of delimiters.
Usage
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.
Examples
<!--- This example shows ListSetAt --->
<HTML>
<HEAD>
<TITLE>ListSetAt Example</TITLE>
</HEAD>
<BODY>
<H3>ListSetAt Example</H3>
<!--- Find a list of users who wrote messages --->
<CFQUERY NAME="GetMessageUser" DATASOURCE="cfsnippets">
SELECT  Username, 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, ",")>