Why not use an array instead?

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


At 18:06 25/08/2003 -0400, you wrote:
>So, say only 3 results are returned - but I need to list to ALWAYS have 10
>positions:
>myLIST = result1|result2|result3|||||||

How about:

<cfif ListLen(myLIST) LT 10>
         <cfset myLIST = "#myLIST##RepeatString('| ', 10-ListLen(myLIST))#">
</cfif>

You could loop and ListAppend, but lists are just strings, may as well just 
throw the extra elements in. I think you need spaces in "empty" elements, 
i.e. ListLen("a,b,c,,,") is just 3, but  ListLen("a,b,c, , , ") is 6 as 
you'd want and expect.

Gyrus
[EMAIL PROTECTED]
play: http://norlonto.net/
work: http://tengai.co.uk/
PGP key available 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to