View Single Post
Old 07-31-2025, 06:13 PM   #4
Far_Pen_6884
Enthusiast
Far_Pen_6884 began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Jul 2025
Device: paperwhite
https://manual.calibre-ebook.com/gen...human-readable

Maybe something like:

program: re_group(human_readable(field('#wordcount')), '([0-9.]+)([KMGTPEZY]?)', '\1\2')

or using the switch_if():

program:
switch_if(
field('#wordcount') >= 1000000, format_number(divide(field('#wordcount'),1000000), '{:.1f}M'),
field('#wordcount') >= 1000, format_number(divide(field('#wordcount'),1000), '{:.1f}K'),
field('#wordcount')
)
Far_Pen_6884 is offline   Reply With Quote