View Single Post
Old 04-18-2015, 03:26 PM   #659
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,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kiwidude View Post
I have been forever using this plugboard for my Kindle from the first post:
{series:|| }{series_index:0>2s|[|] - }{title}

However one thing that it doesnt get right is when the series index is not a round number - e.g. 1.5, 3.1 etc. In those circumstances it does not put the leading 0, which means the ordering is all wrong.

So you end up with:
My Series [01] - Title 1
My Series [02] - Title 2
My Series [1.5] - Title 1.5

Is there a way of fixing this?
The 's' means treat the series as a string. The '2' in front means that it must be at least two letters long. The zero in front of the '>' means fill will the character '0' to meet the minimum length.

Your problem is that you want to treat the series as a floating point number with minimum sizes to the left and right of the decimal. This requires you to use a different type in the template. For example
Code:
{series:|| }{series_index:0>5.1f|[|] - }{title}
will give you minimum 3 digits to the left of the point, the point itself, and 1 digit to the right of the point. If all of your series indices are less than 1000 and have at most 1 digit to the right of the point then the template will work for you. Of course you can adjust the '5' and the '1' to meet your needs.
chaley is offline   Reply With Quote