[SNIPPET] Rounding numbers (for ratings)

All about user-defined episode / movie format expressions
Post Reply
User avatar
rednoah
The Source
Posts: 16984
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[SNIPPET] Rounding numbers (for ratings)

Post by rednoah » 24 Jul 2012, 03:43

Here's some code that'll show you how to round numbers in Groovy.

Just round to integer, i.e. 7, 8, 9, ...

Code: Select all

{rating.round()}
Or if you still want the decimal, i.e. 7.0, 8.0, 9.0, ...

Code: Select all

{rating.round(0)}
:idea: Please read the FAQ and How to Request Help.

Post Reply