03-17-2012, 09:31 AM | #1 |
Guru
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
Save Template: Strip out spaces
I know that it's only cosmetic but I would like to remove spaces from filenames used to send books to my device.
My save template is currently: {title_sort:.8} Can I add some code to either strip out spaces or convert them to hyphens? |
03-17-2012, 11:00 AM | #2 | |
Well trained by Cats
Posts: 29,930
Karma: 55705602
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
(are you having the same problem I have with my PEz. Bookmarks do not work (be able to retrieve location) with files that have spaces? ) |
|
03-17-2012, 11:20 AM | #3 | |
Grand Sorcerer
Posts: 11,770
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
Strip spaces: {title_sort:.8:re( ,)} Convert spaces to hyphens: {title_sort:.8:re( ,-)} Code:
Strip spaces: {title_sort:.8:'re($, ' ' ,'')'} Convert spaces to hyphens: {title_sort:.8:'re($, ' ' ,'-')'} Code:
Strip spaces: {title_sort:'shorten(re($, ' ' ,''), 8, '', 0)'} Convert spaces to hyphens: {title_sort:'shorten(re($, ' ' ,'-'), 8, '', 0)'} Code:
Strip spaces: program: shorten(re(field('title_sort'), ' ', ''), 8, '', 0) Convert spaced to hyphens: program: shorten(re(field('title_sort'), ' ', '-'), 8, '', 0) |
|
03-17-2012, 03:12 PM | #4 |
Guru
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
Thanks for the replies. I used the simple function solution and both stripping and converting work exactly as required. (I'll save the more complex methods for a rainy day!)
(And... No, I was not having a bookmark problem, I just don't like spaces in filenames.) Last edited by Agama; 03-17-2012 at 03:15 PM. |
Tags |
templates |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Old Thread] Save Template not working | TGinAZ | Calibre | 7 | 01-18-2012 01:03 AM |
A little help with a save template...? | Belfaborac | Library Management | 2 | 02-04-2011 09:47 PM |
problem to save with customize template | Roxro | Library Management | 4 | 01-22-2011 07:37 AM |
save file template for series | bucsie | Calibre | 2 | 11-08-2010 02:07 AM |
save to disk template | speakingtohe | Calibre | 9 | 05-29-2010 06:02 AM |