View Single Post
Old 10-30-2018, 07:51 PM   #11
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by chaley View Post
A template function is probably the best because it is the fastest. However, should you want to do it in the template language, this seems to work.
Code:
program: list_re_group(field('author_sort'), ' & ', '.', '(.*?)(,|$)(.*)', '{$:uppercase()}')
It first separates the list of authors, Then for each author it applies a regexp to find the value before the comma and uppercases that value. If there isn't a comma then the entire author is uppercased.
Well, I did say there was probably a better way to do it

I'm not sure if I had read the description of the list_re and list_re_group functions. If I did, they didn't sink in. But, with that example, it's obvious what they do.
davidfor is offline   Reply With Quote