Determines the number of elements in a list.
listLen(list [, delimiters, [includeEmptyValues]])
returns numeric
Name | Type | Required | Default | Description |
---|---|---|---|---|
list | string | Yes | A list or a variable that contains one | |
delimiters | string | No | , | 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. |
includeEmptyValues | string | No | NO | CF10+ If includeEmptyValues is set to true, all empty values in the list will be considered when computing length. If set to false, the empty list elements are ignored. |
Get the number of elements in this list
listLen("foo,bar,bar2,foo2")
Get the number of elements in this list using a custom delimiter
listLen("foo,bar|bar2|foo2", "|")
Get the number of elements in this list, including empty values
listLen("foo,bar,,foo2", ",", "YES")