House of Fusion
Home of the ColdFusion Community
Hostmysite ColdFusion Hosting

Search cf-talk

September 06, 2008

<<   <   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         

Subscribe Now
Fusion Authority Quarterly Update - ColdFusion 8 Special Edition

For ColdFusion hosting try HostMySite.com.
Search over 2,500 ColdFusion resources here  >>>      
Home /  Groups /  ColdFusion Talk (CF-Talk)

Compare digits as strings not integers

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
<CFSET oldcompany = '033'>
Ian Skinner
04/28/08 04:08 P
Use the Compare() function, ie:
Claude Schneegans
04/28/08 04:16 P
Well its ONE way... ;-)
Bobby Hartsfield
04/29/08 09:40 A
Ian,
Axel Schultze
04/29/08 12:05 P
Ian,
Axel Schultze
04/29/08 12:06 P
> <CFSET oldcompany = '033'>
Dave Watts
04/28/08 04:11 P
Dave Watts wrote:
Ian Skinner
04/28/08 04:18 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ian Skinner
04/28/2008 04:08 PM

<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?

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Claude Schneegans
04/28/2008 04:16 PM

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.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bobby Hartsfield
04/28/2008 05:57 PM

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?

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Sonny Savage
04/29/2008 08:11 AM

Using compare() and compareNoCase() is really the right way.  My only gripe is that the returned value isn't very intuitive. On Mon, Apr 28, 2008 at 5:57 PM, Bobby Hartsfield <bobby@acoderslife.com> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bobby Hartsfield
04/29/2008 09:40 AM

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. On Mon, Apr 28, 2008 at 5:57 PM, Bobby Hartsfield <bobby@acoderslife.com> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Axel Schultze
04/29/2008 12:05 PM

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?

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Axel Schultze
04/29/2008 12:06 PM

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?

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
04/28/2008 04:11 PM

> <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/

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ian Skinner
04/28/2008 04:18 PM

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>  


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists