Check if a value in a string variable is numeric

Four Stars

Check if a value in a string variable is numeric

Hello,
How can i check if a Value in a string variable in numeric (integer or real).
Thanks for help
Andreas
Four Stars

Re: Check if a value in a string variable is numeric

You can use regular expression to validate the string as integer or real.
Vaibhav
Four Stars

Re: Check if a value in a string variable is numeric

Hi Vaibhav,
thanks. But im not good in coding Java. Please do you have some code for me.
Andreas
Seventeen Stars

Re: Check if a value in a string variable is numeric

hi,
java parttern 'shortcut' for that :

\d  : A digit:
\D  :  A non-digit:

you can use a tFilterRow tocheck with contains or matches method.
https://help.talend.com/search/all?query=tFilterRow&content-lang=en
https://stackoverflow.com/questions/15130309/how-to-use-regex-in-string-contains-method-in-java
regards
laurent
Four Stars

Re: Check if a value in a string variable is numeric

sorry but i dont know how i use this in a tjavarow.
Seventeen Stars

Re: Check if a value in a string variable is numeric

use tFilterRow. By that way you can have a flow with data matching pattern & reject flow (data doesn't).
see link above to documentation & example from Talend help.
ps : remember that you have shortcut 'F1' to get help for every component directly from your Talend Studio.
regards
laurent

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch