MACROMEDIA COLFUSION MX 7-CFML Reference page 723

Cfml reference
Hide thumbs Also See for COLFUSION MX 7-CFML:
Table of Contents

Advertisement

ListGetAt
Description
Gets a list element at a specified position.
Returns
Index of the list element at position position.
Category
List functions
Function syntax
ListGetAt(list, position [, delimiters ])
See also
,
ListFirst
ListLast
Variables," in ColdFusion MX Developer's Guide
Parameters
Parameter
list
position
delimiters
Usage
If you use list functions on strings that are delimited by a delimiter character and a space, a
returned list element might contain a leading space; you use the
spaces from a returned element. For example, consider this list:
<cfset myList = "one hundred, two hundred, three hundred">
To get a value from this list, use the
<cfset MyValue = #trim(listGetAt(myList, 2))#>
With this usage,
element are preserved.
ColdFusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements.
Example
<h3>ListGetAt Example</h3>
<!--- Find a list of users who wrote messages --->
<cfquery name = "GetMessageUser" datasource = "cfdocexamples">
SELECT Username, Subject, Posted
FROM
Messages
,
,
ListQualify
Description
A list or a variable that contains one.
A positive integer or a variable that contains one. Position at which to get element.
The first list position is 1.
A string or a variable that contains one. Character(s) 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.
trim
= "
MyValue
two hundred
; "Lists" in Chapter 3, "Using ColdFusion
ListSetAt
function to remove the space before the returned value:
", not "
two hundred
function to remove such
trim
", and spaces within a list
ListGetAt
723

Advertisement

Table of Contents
loading

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents