At first this question is needed for iReport. I have to replace the dot sign with comma. My problem is the type of the field out of our database is BigDecimal und therefore does not exist any replace method. So I changed the type to String, but then I got this message:
it.businesslogic.ireport.gui.logpane.ProblemItem@820dc5 The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
My code looks like:
new String($F{gewicht}.toString()).replace(".",",")
What can I do?
You can use a textfield pattern:
<textField pattern="#,##0.00 €">
This will give you the german format. In this case this is for € values but you can skip the € and add more descimals if wanted:
<textField pattern="#,####0.0000">
Another approach whould be:
new DecimalFormat("#,##0.00 €",
new DecimalFormatSymbols(Locale.GERMANY)).
format(Double.parseDouble($F{gewicht}))