use of Mathematical.NUM to determine number

Highlighted
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
Highlighted
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
Highlighted
One Star

Re: use of Mathematical.NUM to determine number

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

2019 GARTNER 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

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

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog