You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Steve973 <st...@gmail.com> on 2018/06/15 14:12:50 UTC

How can I check for empty or null string with ValueBuilder?

If I have a choice block, and if I want to examine an exchange property
with is supposed to be set as a String, how can I check if it's empty or
null?  I can check for empty with exchangeProperty(PROPERTY_NAME).isNull(),
but how can I add the check for an empty string too?

Re: How can I check for empty or null string with ValueBuilder?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can try with simple and the null safe operator and invoke the
isEmpty method on String type

"${exchangeProperty.?foo.isEmpty()}"




On Fri, Jun 15, 2018 at 4:12 PM, Steve973 <st...@gmail.com> wrote:
> If I have a choice block, and if I want to examine an exchange property
> with is supposed to be set as a String, how can I check if it's empty or
> null?  I can check for empty with exchangeProperty(PROPERTY_NAME).isNull(),
> but how can I add the check for an empty string too?



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2