View Single Post
Old 06-19-2015, 06:42 PM   #10
lina.w
Junior Member
lina.w began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jan 2015
Device: none
Quote:
Originally Posted by eschwartz View Post
chaley -- good idea! I haven't really used cmp before, in case you couldn't tell.


lina.w -- pretend I didn't write that. Tested this time.

Code:
program:

formatted_series = finish_formatting(
    field('series_index'),
    '0>4.1f',      #fixed
    ' [',          #fixed
    '] '           #fixed
);
stripped_series = re(
    formatted_series,
    '\.0+',        #fixed
    ''
);

# Add together the final result
strcat(
    field('series'),
    stripped_series,
    field('title')
);
Or as chaley said, because it is semantically correct as opposed to a filthy regex kludge.

Code:
program:

sidx=field('series_index');
i=format_number(sidx, "{:02d}");
f=format_number(sidx, "{:04.1f}");
isInt=cmp(f, i, '', 'yes', '');
final_sidx=finish_formatting(
    test(isInt, i, f),
    '',
    ' [',
    '] '
);

# Add together the final result
strcat(
    field('series'),
    final_sidx,
    field('title')
);
It worked, eschwartz!! Thank you for being so patient with me and for all your help! You are the best!!

And thank you Terisa de morgan & chaley for helping out & answering my questions too. You guys are awesome!

* * e d i t e d * *

this is just a minor problem, but now that I've got the formatting the way I want to, I'm just wondering why [01.5] appears before [01]? Say if I have a series with books with the following numberings [01], [02], and [03]. If I have a novella that goes between each, it should be in this order: [01], [01.5], [02], [02.5], [03], but the current order is [01.5], [01], [02.5], [02], [03]. I'm guessing there is no way to work around fixing this, so would my only option to getting the ordering right be going back to the previous formatting method?

Last edited by lina.w; 06-19-2015 at 06:59 PM.
lina.w is offline   Reply With Quote