May be a more elegant way, but....

<!--- DEFINE LIST --->
<cfset myList = "Bugs|Daffy|Elmer|Tweety|Sylvester|Marvin|Road Runner|Wile
E.|Porky|Granny|Pepe|Taz">

<!--- CONVERT LIST TO ARRAY --->
<cfset myArray = listToArray(myList, "|")>

<!--- IF UNDER 10 ELEMENTS, ADD TO IT --->
<cfif arrayLen(myArray) LT 10>
        <cfset myArray[10] = "">
<!--- IF OVER 10 ELEMENTS, SUBTRACT FROM IT --->
<cfelseif arrayLen(myArray) GTE 11>
        <cfloop from="#arrayLen(myArray)#" to="11" step="-1" index="i">
                <cfset arrayDeleteAt(myArray, i)>
        </cfloop>
</cfif>

<!--- CONVERT ARRAY BACK TO LIST --->
<cfset myList = arrayToList(myArray, "|")>


-Brad

-----Original Message-----
From: Les Mizzell [mailto:[EMAIL PROTECTED]
Sent: Monday, August 25, 2003 10:36 PM
To: CF-Talk
Subject: RE: Forcing a List to a Specific Length


:<>: Why not use an array instead?

Because the Flash guy I'm working with said he needed this information in a
list??


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to