use of Mathematical.NUM to determine number

One Star

use of Mathematical.NUM to determine number

Hi,
I am trying to figure out in a given string how many beginning characters are number
Input
1KSHIR/MIL
2MORE/MOH/NIT
23NONAMES
I am using following functiion to determine this
Mathematical.NUM(StringHandling.LEFT(row1.text1,2))
but its returning 0 for all the rows, is there any other way to determine this ?
Thanks,
Milind
Community Manager

Re: use of Mathematical.NUM to determine number

Hello Milind
I tested that the method Mathematical.NUM(String s) is a bug, I will report it on bugtracker.
For now, you can use the expression like this:
StringHandling.LEFT(row1.text1,2).matches("\\d+")

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: use of Mathematical.NUM to determine number

Thanks Shong, for such a quick and good response !
Milind