Returns list with value inserted at the specified position.
ListInsertAt(list, position, value [, delimiters ])
ListDeleteAt, ListAppend, ListPrepend, ListSetAt
When inserting elements into a list, ColdFusion inserts a delimiter. If delimiters contains more than one delimiter, ColdFusion defaults to the first delimiter in the string, or a 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.
|
Note ColdFusion ignores empty list elements; thus, a list that is defined as "a,b,c,,,d" is treated as a four element list. |
<!--- This example shows ListInsertAt ---> <!--- First, query to get some values for our list. ---> <cfquery name = "GetParkInfo" datasource = "cfsnippets"> SELECT PARKNAME,CITY,STATE FROM PARKS WHERE PARKNAME LIKE 'DE%' </cfquery> <cfset temp = ValueList(GetParkInfo.ParkName)> <cfset insert_at_this_item = ListGetAt(temp, "3", ",")> <cfoutput> <P>The original list: #temp# </cfoutput> <!--- Now, insert an item at position three. ---> <cfset temp2 = ListInsertAt(Temp, "3", "my Inserted Value", ",")>