| CFML Reference
|
|
ColdFusion Functions
|
ArrayResize
Description
Resets an array to a specified minimum number of elements. ArrayResize can provide some performance gains if used to size an array to its expected maximum. For arrays greater than 500 elements, use ArrayResize immediately after creating an array with ArrayNew.
ColdFusion arrays expand dynamically as data is added.
Returns a Boolean TRUE on successful completion.
Category
Array functions
Syntax
ArrayResize(array, minimum_size)
Parameters
| Parameter |
Description |
array
|
Name of an array to resize
|
minimum_size
|
Minimum array size
|
Example <!--- This example shows the use of ArrayResize --->
<html>
<head>
<title>ArrayResize Example</title>
</head>
<body>
<H3>ArrayResize Example</H3>
<!--- perform a query to get the list of course --->
<cfquery name = "GetCourses" datasource = "cfsnippets">
SELECT * FROM Courses
</cfquery>
<!--- make a new array --->
<cfset MyArray = ArrayNew(1)>
<!--- resize that array to the number of records
in the query --->
<cfset temp = ArrayResize(MyArray, GetCourses.RecordCount)>
<cfoutput>
The array is now #ArrayLen(MyArray)# elements, to match
the query of #GetCourses.RecordCount# records.
</cfoutput>
</body>
</html>
|
Copyright © 2001, Macromedia Inc. All rights reserved. |
|
|