I like Jerry's answer but this works too <cfset numbers = "1, 2, 3, 4, 1.5, 1.2, 1.6, 2.5, 7.0, 6.50, 6.32, 2.25" /> <cfloop list="#numbers#" index="i"> <cfoutput>#i# </cfoutput> <cfif (i - int(i) eq 0) or (i - int(i) eq .5)> works <cfelse> no workie </cfif> <br /> </cfloop>
so basically you're subtracting the integer value from the value and if the remainder equals 0 or .5 then it succeeds.. if not then fails On Sat, Feb 20, 2010 at 12:46 AM, Jerry Johnson <[email protected]> wrote: > > multiple by 2, and check if it is a whole number? > > On Sat, Feb 20, 2010 at 1:41 AM, Marie Taylore <[email protected]> wrote: > >> >> I have an app that I need to validate that they enter either whole numbers >> (1,2,3, etc.) or if they DO enter a decimal, it can only be in half >> increments, so 2.5 is okay, but not 2.1, 2.2, 2.25, etc. Of course, 2.0 >> would be okay too, so .0 after the number is fine. >> >> Is there a good way to check that with Regex rather than parsing the string >> and checking that the value after the period is a 5 or a 0? >> >> Thanks, >> >> MarieT >> >> >> >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330978 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

