camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Block <>
Subject Re: Can simple() be made to compare strings in a case insensitive way?
Date Mon, 01 Jun 2015 14:14:40 GMT

Since the value you are comparing against is a String, you can call the toLowerCase method
to convert test to lowercase and compare against that.

In your example, it would be:

.when().simple(“${property.Service?.toLowerCase()} == ‘myservice’)

The ? is added to ensure the value is not null before performing actions on the object. 

- Andy

Andrew Block

On June 1, 2015 at 5:34:53 AM, s.marjanovic ( wrote:


Is there a way to make simple() perform string comparison in a case  
insensitive way ?  

The use case is described below:  

.setProperty("Service", ns.xpath("/MyMessage/Service", String.class))  
.when().simple("${property.Service} == 'myService'")  

If the value of /MyMessage/Service is "myService", simple() will evaluate to  
true, but if /MyMessage/Service is "myservice" it will evaluate to false.  

I can think of a number of hacks for this but I'd like to hear what is the  
camel recommended way to deal with a situation like this.  


View this message in context:
Sent from the Camel - Users mailing list archive at  

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message