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"> <CFIF Find("-", currEle) EQ 0> <!--- not a rnage, increment by 1 ---> <CFSET count = count + 1> <CFELSE> <!--- range, determine range elements ---> <CFSET beginNum = Trim(GetToken(currEle, 1, "-"))> <CFSET endNum = Trim(GetToken(currEle, 1, "-"))> <CFSET count = count + (endNum - beginNum) + 1> </CFIF> </CFLOOP> <CFOUTPUT>There were #count# numbers entered.</CFOUTPUT> -- Mosh Teitelbaum evoch, LLC Tel: (301) 625-9191 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ > -----Original Message----- > From: Tim Do [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 20, 2002 3:38 PM > To: CF-Talk > Subject: parsing user input to get count > > > I have a text field that I allow users to input data as follows: > > 1,2,5-9 > > Basically it is a coma delmited list with a range. Whats the best way to > get a count... in this case I'd need to return 7 > > Thanks in advance... > ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists