Returns the number of elements in the list.
ListLen(list [, delimiters ])
ListAppend,
ListDeleteAt,
ListInsertAt,
ListPrepend.
Parameter |
Description |
---|---|
list |
A list |
delimiters |
Set of delimiters used in list |
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 ListGetAt and ListLen ---> <html> <head> <title>ListLen Example</title> </head> <body> <H3>ListLen 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.Username)> <!--- loop through the list and show it with ListGetAt ---> <H3>This is a list of usernames who have posted messages <cfoutput>#ListLen(temp)#</cfoutput> users.</H3> <UL> <CFLOOP From = "1" TO = "#ListLen(temp)#" INDEX = "Counter"> <cfoutput><LI>Username #Counter#: #ListGetAt(temp, Counter)#</cfoutput> </CFLOOP> </UL> </body> </html>