View Single Post
Old 11-10-2012, 10:18 AM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,802
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Pepin33 View Post
I'm trying to make a saving template in Calibre. I want to get an identifier from my books and format it to remove left zeros.

For example, if identifier in a book is 0000123, I want my book be saved as "123".
Identifiers are always 8 digit numbers, filled with zeros (00000001, 0000002, etc).

I'm trying to use this template: {identifiers:select(my_id):G}, but I get an error saying "my_id" is not a number, but a string.

I was looking at templates languages, but I can't find any function to convert a string to an integer. Anybody can help me?
I am no way a power user of the template language...But

Identifiers: usually consists of 2 parts (the colon is the separator)
1) whose: amazon:
2) the string

Maybe you want: identifier_in_list(val, id, found_val, not_found_val)
theducks is offline   Reply With Quote