tmap remove leading zeros from a string

One Star MNP
One Star

tmap remove leading zeros from a string

I have a customer table (customer number and custumer name). Most of the custumers are integer, but some of them have a "L" in front of them. The custumer number is therefore type string. The problem is that the "integer" custumers have leading zeros - for instance 0000113934 which I can remove if I make it integer, but thats not possible with the custumers starting with "L" for instance L1993493.
I tried in the tmap to make the expression:
StringHandling.LEFT(row1.Customer_number,1).equals("0")?
StringHandling.STR(Mathematical.INT(row1.Customer_number),50): row1.Customer_number
But then I get the error:
The method STR(char, int) in the type StringHandling is not applicable for the arguments (int, int)
I also tried to filter the custumer numbers starting with zero in tmap and then putting the filtered output through tconverttype to cast it to integer and then another tconverttype to cast it back to string, but then when I use tunite with the other output from tmap where the custumer numbers does not start with zero I cannot get it to connect to the tunite.
Any good ideas?
One Star

Re: tmap remove leading zeros from a string

You can't unite two outputs from the same tMap.
Have you tried
StringHandling.LEFT(row1.Customer_number,1).equals("0")?
Integer.toString(Integer.parseInt(row1.Customer_number)): row1.Customer_number
One Star MNP
One Star

Re: tmap remove leading zeros from a string

Thanks a lot - that works just like intended.
Seven Stars

Re: tmap remove leading zeros from a string

My 2 cents even though janhess's solution worked for you Smiley Happy : I like regex for these sorts of things as it's usually a neater expression so I would use:
row1.Customer_number.replaceAll("^0*","")