Trimming leading zeroes

Four Stars

Trimming leading zeroes

How to get a decimal from a string after trimming of leading zeros and non-numeric characters.

Community Manager

Re: Trimming leading zeroes

Can you give a typical example of the String you want to change?

Four Stars

Re: Trimming leading zeroes

Let the string be like

000AB1234

001234AB

I need the output as

1234

1234

Highlighted
Eleven Stars

Re: Trimming leading zeroes

Integer.parseInt(text.replaceAll("[^0-9]", ""))
Regards
Abhishek KUMAR
Four Stars

Re: Trimming leading zeroes

I tried Integer.parseInt(input.replaceAll("[^0-9]", "")) in tjavarow

But I'm getting null in my output

Forteen Stars

Re: Trimming leading zeroes

@Matthew , below one should also work.

 

Integer.parseInt(row1.col1.replaceAll("[^\\d.]", ""))

 

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog