View Single Post
Old 06-19-2015, 01:41 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
I guess you could then regex the number to strip trailing zeroes and periods. But that might require raising the complexity to a General Program Mode template -- I believe formatting comes after functions.

So:

Code:
program:

formatted_series = finish_formatting(
    field('series_index'),
    '4.1f',
    '',
    ''
);
stripped_series = re(
    formatted_series,
    '^ \[(.*)[.0]+\]$',
    ' [\1] '
);

# Add together the final result
strcat(
    field('series'),
    stripped_series,
    field('title')
);
eschwartz is offline   Reply With Quote