House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Compare digits as strings not integers

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

Compare digits as strings not integers.

Ian, Axel Schultze 04/29/2008 12:06 PM
Ian, Axel Schultze 04/29/2008 12:05 PM
Well its ONE way... ;-) Bobby Hartsfield 04/29/2008 09:40 AM
Using compare() and compareNoCase() is really the right way.  My only Sonny Savage 04/29/2008 08:11 AM
Just stick an alpha character in front of them when comparing or compare len Bobby Hartsfield 04/28/2008 05:57 PM
Dave Watts wrote: Ian Skinner 04/28/2008 04:18 PM
Use the Compare() function, ie: Claude Schneegans 04/28/2008 04:16 PM
> <CFSET oldcompany = '033'> Dave Watts 04/28/2008 04:11 PM
<CFSET oldcompany = '033'> Ian Skinner 04/28/2008 04:08 PM

04/29/2008 12:06 PM
Author: Axel Schultze Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56203#304411 Ian, this may work for you. Axel <CFIF oldcompany IS newcompany AND LEN(oldcompany) IS LEN(newcompany)> they are equal <cfelse> they are not equal </CFIF> ><CFSET oldcompany = '033'> ><CFSET newcompany = '0033'> > >How would one compare these as strings and get a NOT equal result rather >then integers resulting in an equal result?
04/29/2008 12:05 PM
Author: Axel Schultze Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56203#304410 Ian, this may work for you. Axel <CFIF oldcompany IS newcompany AND LEN(oldcompany) IS LEN(newcompany)> they are equal <cfelse> they are not equal </CFIF> ><CFSET oldcompany = '033'> ><CFSET newcompany = '0033'> > >How would one compare these as strings and get a NOT equal result rather >then integers resulting in an equal result?
04/29/2008 09:40 AM
Author: Bobby Hartsfield Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56203#304397 Well its ONE way... ;-) .:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com http://cf4em.com Using compare() and compareNoCase() is really the right way.  My only gripe is that the returned value isn't very intuitive. ----- Excess quoted text cut - see Original Post for more -----
04/29/2008 08:11 AM
Author: Sonny Savage Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56203#304390 Using compare() and compareNoCase() is really the right way.  My only gripe is that the returned value isn't very intuitive. ----- Excess quoted text cut - see Original Post for more -----
04/28/2008 05:57 PM
Author: Bobby Hartsfield Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56203#304361 Just stick an alpha character in front of them when comparing or compare len AND value. .:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com http://cf4em.com <CFSET oldcompany = '033'> <CFSET newcompany = '0033'> How would one compare these as strings and get a NOT equal result rather then integers resulting in an equal result?
04/28/2008 04:18 PM
Author: Ian Skinner Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56203#304355 Dave Watts wrote: ----- Excess quoted text cut - see Original Post for more ----- I was considering that, but I felt sure there was a CF way to do this, finally found the right documentation page compare().   <CFSET aVal = '033'>   <CFSET bVal = '0033'>        <cfoutput>         #aVal#:#bVal#         #aVal EQ bVal#         #aVal IS bVal#         #compare(aVal,bVal)#     </cfoutput>  
04/28/2008 04:16 PM
Author: Claude Schneegans Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56203#304354 Use the Compare() function, ie: <CFSET oldcompany = '033'> <CFSET newcompany = '0033'> <CFOUTPUT>#(oldcompany EQ newcompany)#<BR> #(Compare(oldcompany, newcompany) EQ 0)# </CFOUTPUT> -- _______________________________________ REUSE CODE! Use custom tags; See http://www.contentbox.com/claude/customtags/tagstore.cfm (Please send any spam to this address: piegeacon@internetique.com) Thanks.
04/28/2008 04:11 PM
Author: Dave Watts Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56203#304353 > <CFSET oldcompany = '033'> > <CFSET newcompany = '0033'> > > How would one compare these as strings and get a NOT equal > result rather then integers resulting in an equal result? You could tack a non-numeric value to the end of each, and compare the resultant strings. There may be a better, and/or more elegant way, that's just off the top of my head. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Training: Adobe/Google/Paperthin Certified Partners http://training.figleaf.com/ WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers! http://www.webmaniacsconference.com/
04/28/2008 04:08 PM
Author: Ian Skinner Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56203#304351 <CFSET oldcompany = '033'> <CFSET newcompany = '0033'> How would one compare these as strings and get a NOT equal result rather then integers resulting in an equal result?
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference