Quantcast

comparing strings using ignore case

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

comparing strings using ignore case

abhinay_agarwal
hey,

is there a method by which i can compare two string ignoring there case ??

for me writing the code as

foo : ObjectTypeA()
bar : ObjectTypeB( name.equalsIgnoreCase( foo.name ) )

is a long process because i m comparing the values of string which are present inside a map..and there are loads of comparision..

$h : HashMap(this["Account_Ownership_Type"]=="Single")

Does drools have an easier way for ignore case comparision ??

Thanks,
Abhinay
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

laune
You can write a custom operator which would let you write
   ObjectTypeB( name  equalsignorecase foo.name ) )
You can choose a shorter name for the operator ;-)
-W

On 06/07/2012, abhinay_agarwal <[hidden email]> wrote:

> hey,
>
> is there a method by which i can compare two string ignoring there case ??
>
> for me writing the code as
>
> foo : ObjectTypeA()
> bar : ObjectTypeB( name.equalsIgnoreCase( foo.name ) )
>
> is a long process because i m comparing the values of string which are
> present inside a map..and there are loads of comparision..
>
> $h : HashMap(this["Account_Ownership_Type"]=="Single")
>
> Does drools have an easier way for ignore case comparision ??
>
> Thanks,
> Abhinay
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/comparing-strings-using-ignore-case-tp4018504.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

adeyinka.timi
In reply to this post by abhinay_agarwal
I am out of office until Tuesday, 17th of July. If you have any urgent queries, you can contact Robert Doherty at [hidden email] 01 6853001

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

abhinay_agarwal
In reply to this post by laune
how can i use that with the values of hashmap ???...can yu show me an example !!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

adeyinka.timi
In reply to this post by abhinay_agarwal
I am out of office until Tuesday, 17th of July. If you have any urgent queries, you can contact Robert Doherty at [hidden email] 01 6853001

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

laune
In reply to this post by abhinay_agarwal
There is no Map in your 1st post.
-W

On 09/07/2012, abhinay_agarwal <[hidden email]> wrote:

> how can i use that with the values of hashmap ???...can yu show me an
> example
> !!
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/comparing-strings-using-ignore-case-tp4018504p4018527.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

adeyinka.timi
In reply to this post by abhinay_agarwal
I am out of office until Tuesday, 17th of July. If you have any urgent queries, you can contact Robert Doherty at [hidden email] 01 6853001

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

abhinay_agarwal
In reply to this post by laune
$h : HashMap(this["Account_Ownership_Type"]=="Single")

m using this for comparision right now...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

adeyinka.timi
In reply to this post by abhinay_agarwal
I am out of office until Tuesday, 17th of July. If you have any urgent queries, you can contact Robert Doherty at [hidden email] 01 6853001

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

laune
In reply to this post by abhinay_agarwal
$h : HashMap()
eval( $h.get( "Account_Ownership_Type" ).equals("Single") )

On 09/07/2012, abhinay_agarwal <[hidden email]> wrote:

> $h : HashMap(this["Account_Ownership_Type"]=="Single")
>
> m using this for comparision right now...
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/comparing-strings-using-ignore-case-tp4018504p4018530.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

adeyinka.timi
In reply to this post by abhinay_agarwal
I am out of office until Tuesday, 17th of July. If you have any urgent queries, you can contact Robert Doherty at [hidden email] 01 6853001

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

laune
In reply to this post by laune
On 09/07/2012, Wolfgang Laun <[hidden email]> wrote:
> $h : HashMap()
> eval( $h.get( "Account_Ownership_Type" ).equals("Single") )

Here you cannot use a custom operator, but you can write a function

function testmap( Map m, String key, String value ){
    return m.get( key ).equalsIgnoreCase( value );
}

-W


>
> On 09/07/2012, abhinay_agarwal <[hidden email]> wrote:
>> $h : HashMap(this["Account_Ownership_Type"]=="Single")
>>
>> m using this for comparision right now...
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/comparing-strings-using-ignore-case-tp4018504p4018530.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

adeyinka.timi
In reply to this post by abhinay_agarwal
I am out of office until Tuesday, 17th of July. If you have any urgent queries, you can contact Robert Doherty at [hidden email] 01 6853001

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

abhinay_agarwal
In reply to this post by laune
cant i use something like :

$h: HashMap()
eval( $h.get( "Account_Ownership_Type" ).equalsIgnoreCase("Single") )

????
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

adeyinka.timi
In reply to this post by abhinay_agarwal
I am out of office until Tuesday, 17th of July. If you have any urgent queries, you can contact Robert Doherty at [hidden email] 01 6853001

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

laune
In reply to this post by abhinay_agarwal
Of course - any Java expression. See the Expert manual.


On 09/07/2012, abhinay_agarwal <[hidden email]> wrote:

> cant i use something like :
>
> $h: HashMap()
> eval( $h.get( "Account_Ownership_Type" ).equalsIgnoreCase("Single") )
>
> ????
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/comparing-strings-using-ignore-case-tp4018504p4018537.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

adeyinka.timi
In reply to this post by abhinay_agarwal
I am out of office until Tuesday, 17th of July. If you have any urgent queries, you can contact Robert Doherty at [hidden email] 01 6853001

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

abhinay_agarwal
In reply to this post by laune
but its throwing me an error :

Build Error : 'Unable to build expression for 'eval' : null '$h.get( "Account_Ownership_Type" ).equalsIgnoreCase("Single") '
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

adeyinka.timi
In reply to this post by abhinay_agarwal
I am out of office until Tuesday, 17th of July. If you have any urgent queries, you can contact Robert Doherty at [hidden email] 01 6853001

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [rules-users] comparing strings using ignore case

laune
In reply to this post by abhinay_agarwal
It works for me.

Don't post incomplete snippets, please.

-W


On 09/07/2012, abhinay_agarwal <[hidden email]> wrote:

> but its throwing me an error :
>
> *Build Error : 'Unable to build expression for 'eval' : null *'$h.get(
> "Account_Ownership_Type" ).equalsIgnoreCase("Single") '
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/comparing-strings-using-ignore-case-tp4018504p4018541.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Loading...