re: parsing user input to get count

2002-09-20 Thread todd
listLen() -- Todd Rafferty ([EMAIL PROTECTED]) - http://www.web-rat.com/ | Team Macromedia Volunteer for ColdFusion | http://www.macromedia.com/support/forums/team_macromedia/ | http://www.flashCFM.com/ - webRat

RE: parsing user input to get count

2002-09-20 Thread Bryan Love
Unfortunately it's messy... cfset numList = 1,2,5-9 cfset count = 0 cfloop list=#numList# index=i cfif i CONTAINS - cfset count = count + abs(val(i)) cfelse cfset count = count + 1 /cfif /cfloop

RE: parsing user input to get count

2002-09-20 Thread Dan Haley
The following would work on what you are showing, but won't do any validation of inputs ... cfset count = 0 cfloop list=#inputData# index=curItem cfif listlen(curItem, -) eq 1 cfset count = count + 1 cfelse cfset count = (listlast(curItem, -) -

RE: parsing user input to get count

2002-09-20 Thread todd
Hehehe... I thought he was just shorthanding for the email. ;) My bad. On Fri, 20 Sep 2002, Bryan Love wrote: Unfortunately it's messy... cfset numList = 1,2,5-9 cfset count = 0 cfloop list=#numList# index=i cfif i CONTAINS - cfset count = count + abs(val(i))

RE: parsing user input to get count

2002-09-20 Thread Tim Do
yes.. I understand that listLen() would work for a coma delimited list, but I also have a range in there -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 1:23 PM To: CF-Talk Subject: re: parsing user input to get count listLen

Re: parsing user input to get count

2002-09-20 Thread Nick Han
try this... cfset inputField=1,2,5-10 cfset count=0 cfset temp=0 cfloop list=#inputField# index=i delimiters=, cfif Find(-,i,1) cfset temp=abs(evaluate(i)) /cfif cfset count=count+1+temp /cfloop cfoutput#count#/cfoutput Nick Han [EMAIL PROTECTED] 09/20/02 11:28AM I have a text

RE: parsing user input to get count

2002-09-20 Thread Mosh Teitelbaum
Because you're allowing users to enter ranges, you will probably have to loop over the input list and parse out the ranges, manually counting each element. For example: CFPARAM NAME=FORM.numList DEFAULT= CFSET count = 0 CFLOOP LIST=#FORM.numList# INDEX=currEle

RE: parsing user input to get count

2002-09-20 Thread Tim Do
It worked great! Thanks to all the responded. Tim -Original Message- From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 3:20 PM To: CF-Talk Subject: RE: parsing user input to get count Because you're allowing users to enter ranges, you will probably