Steve,

Here's the output I get from your code:

initial : 1,2,3,4,5,6,10,11,12,13,14,20,25,30,31,32,33,50
desired : 1-6,10-14,20,25,30-33,50
computed:
0-0,2-0,3-0,4-0,5-0,6-0,10-0,11-0,12-0,13-0,14-0,20-0,25-0,30-0,31-0,32-0,33
-0

Cheers,
barneyb

> -----Original Message-----
> From: Steve Nelson [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 19, 2004 11:26 AM
> To: CF-Talk
> Subject: RE: **UPDATE** Arrange sequential selections into
> ranges how to???
>
> Sorry about that... Here's my 3 minute attempt. I haven't
> tested it. At a
> second glance I think it screws up the first group.
>
>  
>
> Steve Nelson
>
>  
>
>  
>
> <cfset var1 = "1,2,3,4,5,6,10,11,12,13,14,20,25,30,31,32,33,50">
>
>  
>
> <cfset var2="">
>
> <cfset lastitem=listfirst(var1)-1>
>
> <cfset groupstart=lastitem>
>
> <cfloop list="#var1#" index="item">
>
>             <cfif item gt lastitem+1>
>
>                         <cfset newgroup="#groupstart#-#lastitem#">
>
>                         <cfset var2=listappend(var2,newgroup)>
>
>                         <cfset groupstart=item>
>
>             </cfif>
>
> </cfloop>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to