Page 1 of 1

File numbering format

PostPosted: Tue Jun 08, 2021 5:35 am
by DavidS
I want to be able to choose a numbering format which includes a separator for the thousands; for example 3,436 or 3'456. I know I could add a number at the front then run BRU again to insert the separator, but that's a kludge for an otherwise gorgeous app.

Re: File numbering format

PostPosted: Tue Jun 08, 2021 4:19 pm
by therube
For something like that, if there existed the ability to rearrange the ordering in which the different tasks were performed...

As it is, 7:Add is done before 10:Numbering.
But if you had the option to rearrange, such that 10:Numbering was done first, then 7:Add was done after that, you could then do something like:

10:Numbering, Mode: Prefix, Start: 1000
7:Add, Insert: ', at: 2

Re: File numbering format

PostPosted: Wed Jun 09, 2021 12:57 am
by Admin
Hi,

this javascript function adds a counter customly formatted with a . and , and can be used in BRU renaming:

Code: Select all
Number.prototype.format = function(n, x, s, c) {
    var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\D' : '$') + ')',
        num = this.toFixed(Math.max(0, ~~n));

    return (c ? num.replace('.', c) : num).replace(new RegExp(re, 'g'), '$&' + (s || ','));
};

newName = (counter).format(0, 3, ',', '.') + "-" + name;

Re: File numbering format

PostPosted: Wed Jun 09, 2021 10:15 am
by Luuk
Yes, this very easy with brc64.exe, because you can specify to conduct auto-numbering before regex, so then regex can modify the auto-numbers.
But without the javascript, you are already doing it the best way, so then just having to fix the auto-numbers with another run.