How to convert Long to String and String to Long

One Star

How to convert Long to String and String to Long

HI,
Could any one post the solution for converting Long to String and String to Long.
Thanks,
-Teja

Re: How to convert Long to String and String to Long

Long to String:
<var>.toString()
//to protect agianst null pointers:
<var> == null ? null : var.toString()

String to Long:
Long.parseLong(<var>)
One Star

Re: How to convert Long to String and String to Long

If you have to do a lot of this type of conversion, you may want to consider tConvertType.
This is a link to a video that converts Strings to Longs w/o having to add Java in expressions.
http://bekwam.blogspot.com/2011/02/tutorial-converting-data-types-with.html
-Carl

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch