View Single Post
Old 09-11-2017, 06:30 AM   #790
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,485
Karma: 8025704
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by sha View Post
I'm trying to make my plugboards truncate trailing zeros while maintaining leading zeros.

Example:

Series 01 Title
Series 02 Title
Series 02.5 Title
Series 11 Title

What's happening right now (I've tried variations of 0>2.1f, 0>2s, g, etc):

Series 01.0 Title
Series 02.0 Title
Series 02.5 Title
Series 11.0 Title

or:

Series 1 Title
Series 11 Title
Series 2 Title
Series 2.50 Title

Any help would be appreciated.
This Template Program Mode template does the job. It distinguishes between integer and floating point series numbers, picking different formatting. For floating point numbers it removes any trailing zeros after the number is formatted.
Code:
{series_index:'contains($, '\.', re(format_number($, '0>5.2f'), '0*$', ''), format_number($, '0>2d'))'}
chaley is offline   Reply With Quote