Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Labels (2)
2 Replies
Anonymous
Not applicable
Author

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

String to Long:
Long.parseLong(<var>)
Anonymous
Not applicable
Author

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