View Single Post
Old 06-12-2023, 05:37 AM   #635
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,522
Karma: 8065528
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
What would be the best way to remove excessive whitespaces in the middle of a value? (Calibre seems to remove them at the beginnings and endings.)

I was thinking something like re checking for two or more spaces but wasn't sure if there was a better way.
I would use
Code:
re(val, '\s+')
Quote:
Originally Posted by ownedbycats View Post
Additional question:

I have this template for listing the first letter (or 0-9 if numeric)

Code:
{title_sort:'contains(t=uppercase(re($, '^\W*(\w).*$','\1')), '\d', '0-9', t)'}
I'd like to use transliterate() to standardize the letters (currently accented characters shown separately). How would I add that?
Code:
{title_sort:'contains(t=transliterate(uppercase(re($, '^\W*(\w).*$','\1'))), '\d', '0-9', t)'}
chaley is offline   Reply With Quote