reading excel file value goes with comma

132 Views Asked by At
FormulaEvaluator formulaEval= workbook.getCreationHelper().createFormulaEvaluator();
    CellValue evaluate = formulaEval.evaluate(row.getCell(k));
    cellValue = evaluate.formatAsString();

I'm getting an excel value and put this value into the data base.
but when I put the cellvalue inside of database. I want to some value
name = jake;
but it goes with comma name = "jake"

how to put some value without comma?

1

There are 1 best solutions below

0
JensS On

For the simplest version, you can just replace all quotation marks like this:

cellValue = evaluate.formatAsString().replaceAll("\"", "");

If you need more complex operations (for example if quotation marks inside the String should be allowed), you can use the regex operators ^ (start of line) and $ (end of line).