开发者

HSSFCell - determining what type of numeric

Using Apache POI, I am trying to process a large amount of numeric data. I am checking for the cell type, for instance

     case HSSFCell.CELL_TYPE_NUMERIC:
                value = String.valueOf(cell.getNumericCellValue());
                break;

Is there a way I can determine what type of numeric value t开发者_如何学JAVAhe cell holds? For instance, how do I know that it is safe to cast the return value to a non-floating point value?


getNumericCellValue returns double for all the numeric cells. You can check values like this:

if( Math.floor(d) == d ) {
...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜