This seems so simple, I am so frustrated...
The short:
I'm reading values from excel, and printing to xml, which works fine.
The problem is with decimals.
Some cells are values like 1,15,27
others have values like 115.0,183.5 etc.
The problem is that HSSF reads all number cells as doubles by default. in the past i used a simple (int) to turn it into an integer.
Now, if there is a .0, I need to preserve it, otherwise i just want the integer value.
heres what i have
// if value in cell has ., respect it
// otherwise just get int.
String angry=String.valueOf(currentRow.getCell((short) (columnNumber)).getNumericCellValue());
if(angry.contains(".")){
result[col]=String.valueOf((double)(currentRow.getCell((short) (columnNumber)).getNumericCellValue()));
}else{
result[col]=String.valueOf((currentRow.getCell((short) (columnNumber)).getNumericCellValue()));
}
problem with that is all numbers pulled will be doubles(have the decimal) even if that is not how they are in excel.
So how can I examine the contents of the cell, without converting it to a string.
thank you so much!