arrayResize
Description
Resets an array to a specified minimum number of elements. Resetting can improve performance, if used to size an array to its expected maximum. For more than 500 elements, use ArrayResize immediately after using the ArrayNew tag.
Categories
Syntax
ArrayResize(array, minimum_size)
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| array | Name of an array | ||
| minimum_size | Minimum array size |
Returns
True,
on successful completion.
Example
<h3>ArrayResize Example</h3>
<!--- Perform a query to get the list. --->
<cfquery name = "GetCourses" datasource = "cfdocexamples">
SELECT * FROM Courses
</cfquery>
<!--- Create 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>