I need help on how to remove a $ signs from a string before updating DB Currently in my application the from end on default adds a $ as a first character. I need to know how I can remove that because I get the Big Decimal error when updating DB.
String postagePaid = (String) request.getParameter("tPostagePaid");
String insuranceFees = (String) request.getParameter("tInsuranceFees");
String registeredFees = (String) request.getParameter("tRegisteredFees");
String codFees = (String) request.getParameter("tCODFees");
String insRegisteredCODFees = (String) request.getParameter("tInsuranceFees");
System.out.println("insurance Fee: " + insuranceFees);
if (postagePaid != null && !insuranceFees.isEmpty()) { // postage paid amount
claim.setClPostagePaidAmt(new BigDecimal(postagePaid));
}
if (insuranceFees != null && !insuranceFees.isEmpty()) { // Insurance Fees
claim.setClInsuranceFee(new BigDecimal(insuranceFees));
}
if (registeredFees != null && !insuranceFees.isEmpty()) { // Registered Fees
claim.setClRegisteredFee(new BigDecimal(registeredFees));
}
if (codFees != null && !insuranceFees.isEmpty()) { // COD Fees
claim.setClCodFee(new BigDecimal(codFees));
}
claim.setClInsRegCodAmt(null);
You can try two things.
str = str.replace("$","");
OR
str = str.substring(1);
REASON
You just want to remove the first character.