View Single Post
Old 06-17-2020, 08:37 AM   #3
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,471
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
FWIW: the line
Code:
index = template('{series_index:0>2s}');
can be replaced with
Code:
idx = field('series_index');
index = contains(idx, '\.', format_number(idx, '05.2f'), format_number(idx, '02d'));
which has much better performance and deals with floating point series indices.

If you want all series indices to be the same length, in the example's case 5 (nn.nn), then you could use
Code:
format_number(field('series_index'), '05.2f')
chaley is offline   Reply With Quote