Converting String to Boolean

One Star

Converting String to Boolean

Hi All,
How to convert string to boolean in tmap ?
Thanks&Regards
Aishu

Re: Converting String to Boolean

You can use folowing code to convert -
String strBoolean = "true";

//Do the String to boolean conversion
boolean theValue = Boolean.parseBoolean(strBoolean);
System.out.println(theValue);
Moderator

Re: Converting String to Boolean

Hi Aishu,
Could you give us more information about your requirement? Why do you want to Converting String to Boolean? Perhaps we have a better suggestion for your work design.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Converting String to Boolean

Hi xdshi,
My requirement is source column data type is string and data like true,false
but target column data type is boolean.
I converted string to Boolean using this function
"Boolean.parseBoolean(row3.column_name) "
Regards
Aishu
Moderator

Re: Converting String to Boolean

Hi,
If your Input is "true or false", it is totally OK. Maybe the following expression is also a good option
Boolean.valueOf(row3.column_name)

.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Converting String to Boolean

Hi Sabrina

Just now i checked your code ,it is working fine.
thanks for your replay.
Regards
Aishu
Moderator

Re: Converting String to Boolean

Hi Aishu,
You are welcome, and thanks your feedback. Feel free to post your issue on forum.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.