I want to read data from Excel - only numbers so I can compare it later, I go in a loop and I have code like this:
int type = cell.getCellType();
switch(type){
case 0:
int value = (int)cell.getNumericCellValue();
case 1:
String temp = cell.getStringCellValue();
int value = Integer.parseInt(temp);
}
It's like this because sometimes data in Excel have numeric type, sometimes string type.
Now my questions. Is casting to int a good idea?
If I have number 1.200 in a cell with type String so it's "1.200" how to convert it to int (or float if it's better)? What is the best way to do it?
All I need is - numbers (sometimes from String cell types) so I can compare it with numbers from another datasource.