1

I am learning talend open studio and I want to put this line of code :

boolean numeric = isNumeric(input_row.id);

In tjavaroW, but when I run the job it throws me an error:

isNumeric is an undefined method

. Please can you tell me how to solve this problem?

Thanks a lot.

Victor Manuel
  • 174
  • 1
  • 9
DrGenius
  • 817
  • 1
  • 9
  • 26
  • If you're looking for an `isNumeric()` implementation, see [How to check if a String is numeric in Java](https://stackoverflow.com/q/1102891/5221149). – Andreas Feb 20 '20 at 09:29
  • A method in java is always part of a class. In which class is method `isNumeric()` defined? – Abra Feb 20 '20 at 09:37

2 Answers2

1

You can check.. if the input is numeric or not using below piece of code at tJavaRow

boolean isNumeric=true;
try{
    Integer i = Integer.parseInt(input_row.id);
} catch(Exception ex){
    isNumeric = false;
}
Aditya Rewari
  • 2,343
  • 2
  • 23
  • 36
0

In Talend you must indicate the Library you are using. For instance : StringUtils.isNumeric.

Carassus
  • 132
  • 6