|
|
|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98
NOTE: One-dimensional arrays are essentially the same as a ColdFusion list.
CFML comes with a large number of functions to handle array manipulation. These include
- ArrayAppend(arr,element)Adds element to the end of the array arr. Returns a value of TRUE if successful.
- ArrayAvg(arr)Returns the average value of the elements in the array arr.
- ArrayClear(arr)Clears all elements from the array arr. Returns a value of TRUE if successful.
- ArrayDeleteAt(arr,index)Removes the element at position index from the array arr. Returns a value of TRUE if successful.
- ArrayInsertAt(arr,index,element)Inserts element into the array arr at position index. Returns a value of TRUE if successful.
- ArrayIsEmpty(arr)Returns TRUE if arr has no elements or FALSE if arr has at least one element.
- ArrayLen(arr)Returns the length of the array arr.
- ArrayMax(arr)Returns the maximum value in the array arr.
- ArrayMin(arr)Returns the maximum value in the array arr.
- ArrayPrepend(arr,element)Adds element at the front of the array arr. Returns a value of TRUE if successful.
- ArrayResize(arr,min_size)Resizes the array arr to have at least min_size elements.
- ArraySort(arr,type,order)Sorts the array arr according to the type of sort specified (numeric, text, or textnocase). The sort order can be ascending (asc) or descending (desc).
- ArraySum(arr)Returns the sum of the elements in the array arr.
- ArrayToList(arr,del)Converts the array arr to a list with the delimiter character del.
- IsArray(variable)Returns TRUE if variable is an array.
List Functions
ColdFusion lists are delimited sets of items. The default delimiter is a comma (,), but you can use any other character you would like to delimit your lists. You can even choose to have more than one delimiter character.
The same as with arrays, CFML comes with many functions that support rapid processing of lists. Some of the key CFML list functions follow. In each case, del is a string of list delimiters.
- ListAppend(lst,item,del)Adds item to the end of the list lst.
- ListChangeDelims(lst,new_del,del)Replaces all delimiters in the list lst with new_del.
- ListContains(lst,str,del)Returns the position of the first item in the list lst that contains str as a substring. The substring search is case sensitive.
- ListContainsNoCase(lst,str,del)Returns the item number of the first item in the list lst that contains str as a substring. The substring search is not case sensitive.
- ListDeleteAt(lst,pos,del)Deletes the item at position pos from the list lst.
- ListFind(lst,item,del)Returns the position of the first instance of item in the list lst. Search is case sensitive.
- ListFindNoCase(lst,item,del)Returns the position of the first instance of item in the list lst. Search is not case sensitive.
- ListFirst(lst,del)Returns the first item from the list lst.
- ListGetAt(lst,pos,del)Returns the item at position pos from the list lst.
- ListInsertAt(lst,pos,item,del)Inserts item at position pos of the list lst.
- ListLast(lst,del)Returns the last item from the list lst.
- ListLen(lst,del)Returns the number of items in the list lst.
- ListPrepend(lst,item,del)Adds item to the front of the list lst.
- ListRest(lst,del)Returns all items in the list lst except for the first one.
- ListSetAt(lst,pos,item,del)Sets the value of the item at position pos in the list lst to item.
- ListToArray(lst,del)Converts the list lst to a one-dimensional array.
|