On Tue, Apr 7, 2009 at 12:12 AM, Pranathi Reddy <[email protected]> wrote:
> I am comparing two strings.... and if I have 2 strings....
> String1: 0010as10000
> String2: 10as1
> I should get an output that these two strings are equal.
> If I use Trim,LTrim,Rtrim, compare().. what ever I use I am getting that 
> strings are not equal... how do I compare these types of strings and display 
> that these strings are equal.

So... what rules are you working with?  Are you saying that any
leading/trailing zeros should be ignored?

If so, rereplace(string1, '^0*|0*$', '', 'all') should remove
leading/trailing zeros.

So if you have:

<cfset string1 = "0010as10000" />
<cfset string2 = "10as1" />

<cfoutput>#compareNoCase(rereplace(string1, '^0*|0*$', '', 'all'),
rereplace(string2, '^0*|0*$', '', 'all'))#</cfoutput>

should return 0 (no differences in the compareNoCase())



-- 
I have failed as much as I have succeeded. But I love my life. I love
my wife. And I wish you my kind of success.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321384
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to