View Single Post
Old 01-24-2023, 04:30 AM   #489
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 ownedbycats View Post
Question:
[...]
Code:
program:
	genre = $#subjects;

	colls = strcat(	
		$#booktype,	
		if 'overdrive' in approximate_formats() then 'Loans,' fi,
		if $$#purchasecost == '0.00' then 'Freebies,' fi,
		if '^Horses$' inlist genre then 'Horses,' fi,
		if '^Cozy Mystery$' inlist genre then 'Cozy Mysteries,' fi,
		if '^(Fantasy|Science Fiction|Paranormal)$' inlist genre then 'Fantasy & Sci-Fi,' fi,
		if 'Omnibus' in $#admintags then 'Omnibuses' fi
);

 new_colls = list_union($#kobocoll, colls, ',')
How do I get #booktype to also return a comma?
Add the comma to the strcat().
Code:
program:
	genre = $#subjects;

	colls = strcat(	
		$#booktype, ',',
		[...]
Don't worry about the possibility of colls ending in a comma. The list_union() will remove it.
chaley is offline   Reply With Quote