CrimsonKing CrimsonKing - 1 year ago 45
Java Question

Play2 Framework Float Format in Template

I got a little Problem with a Float Value in a Play Template. I wrote this code


and I got this error:
Overloaded method value [format] cannot be applied to (String, Float)

I alredy tried other ways, but it wasn't successfull.
I'm searching for a possibility to get an output like this: 2,30
Maybe someone can help me,

m-z m-z
Answer Source

That is not the correct usage for String.format. format must be called on the instance of a String, which contains the formatting.



returns "2.19".

You'll want something like this: