xmcamino Posted September 24, 2020 Share Posted September 24, 2020 Hello,I have a decimal issue in my report. I use the expression: new java.text.DecimalFormat("##0.0").format($F{score})and I want decimals with point (.) not with comma (,) in the 'score' value. I am using jasperstudio on windows 10.How can I fix this, please?Regards,MAC Link to comment Share on other sites More sharing options...
yann22580 Posted September 25, 2020 Share Posted September 25, 2020 Hi xmcamino,What is the type of your field ? For a double or a Big Decimal you can use this : String.format("%,.2f",$F{field_name}).2f is for a dot as a separator then 2 floating point on a decimal number. But my locale is 'France' on my PC so the dot become a comma.Examples :System.out.format("%.3f%n", pi); // --> "3.142"System.out.format("%10.3f%n", pi); // --> " 3.142"System.out.format("%-10.3f%n", pi); // --> "3.142"System.out.format(Locale.FRANCE,"%-10.4f%n%n", pi); // --> "3,1416"https://docs.oracle.com/javase/tutorial/java/data/numberformat.htmlYou can check on your locale or set the locale directly in the format function.Hope it will help you,Yann Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now