I am new to Java programming. I am trying to read excel file where the cell data is in String value. I would like to get the value in double or int. Here's the example data: 3,199,800.00 and 400,573.80. Now, I want to get the value as 3199800 and 400573.8.
I can get those values using this code:
String value = valueCell.getStringCellValue()
.trim()
.replace(",", "")
.replace(".00", "")
.replace(".10", ".1")
.replace(".20", ".2")
.replace(".30", ".3")
.replace(".40", ".4")
.replace(".50", ".5")
.replace(".60", ".6")
.replace(".70", ".7")
.replace(".80", ".8")
.replace(".90", ".9");
Is there a way where I can minimize the above code. Thank you!
Edited: Just to add, I want to keep the result as a string. thank you!