View Single Post
Old 02-12-2024, 02:57 AM   #8
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,463
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by zimpt View Post
I want to merge all those epubs. But because sorting by "Title" it sorts digit after digit instead of the whole number I thought it would be the best to add leading zeroes so the chapters are in the right order
@BetterRed's suggestion is best, but you can get what you want by checking
the option Preferences / Behavior / Recognize numbers inside text when sorting.
Click image for larger version

Name:	Clipboard07.jpg
Views:	199
Size:	45.5 KB
ID:	206323

With the option unchecked:
Click image for larger version

Name:	Clipboard08.jpg
Views:	196
Size:	11.6 KB
ID:	206322

With the option checked:
Click image for larger version

Name:	Clipboard06.jpg
Views:	197
Size:	12.3 KB
ID:	206324

You can also use a bulk search & replace with source "template" to change the titles to have a fixed number of leading zeros This is complicated and error prone so I don't recommend it. The template would be something like this, assuming that the number always appears at the end and that it can be floating point:
Code:
program:
	text = re($title, '^(.*?)[\d\.]*$', '\1');
	digits = re($title, '.*?((\d+(?:\.\d*)?|\.\d+)).*?', '\1');
	digits = format_number(digits, '08.2f');
	title = text & digits
chaley is offline   Reply With Quote