Page 1 of 1

Add Commas to Make a Comma Separated Number

Posted: 2020-07-19 03:06:03
by DaveyMames
I use YouTube-DL to automatically download videos and add the view count of a video to give a filename like this:

Code: Select all

Video Title, Views 1920002564
Is there any setting I can use in Ant Renamer to add commas to the number in order to separate the number with commas like this?:

Code: Select all

1,920,002,564
Is there a way to have Ant Renamer separate the 11 last characters of the file name with commas but only if those characters are numbers?

Re: Add Commas to Make a Comma Separated Number

Posted: 2020-07-20 16:46:55
by antp
Using regular expressions you achieve that. But you mention 11 last character, is it always 11? Or could it be less?

Re: Add Commas to Make a Comma Separated Number

Posted: 2020-07-21 06:31:19
by DaveyMames
The end of a video title will always be like this except the number will be different based on the actual views the video got:

Code: Select all

View Amount 1920002564
11 characters is the max length that the views could be as it's in billions.
1 character is the minimum length the views could be.

So I would like Ant Renamer to add the thousands separator (commas) to the last 1-11 characters of the file name but only if those characters contain a number. How would I do that?

Re: Add Commas to Make a Comma Separated Number

Posted: 2020-07-23 13:15:59
by antp
With the variable-length, I'm not sure it is possible using Ant Renamer.
Theoretically it seems possible using Regular Expressions, from what I find on internet, but what I found is not supported by the engine embedded in Ant Renamer and I don't see how to make it with what I know, sorry :/
(also sorry for the delay, but I was quite busy in the last few days)

Re: Add Commas to Make a Comma Separated Number

Posted: 2020-07-24 18:32:53
by DaveyMames
What about if I had the views at the start of the filename like this:

Code: Select all

20200705 Views 1,454,321
Would it then be possible to have the views number seperated by commas?

That way the views amount will always start on the 16th character. The views number could be between 1-11 characters in length.

Re: Add Commas to Make a Comma Separated Number

Posted: 2020-07-27 10:26:14
by antp
The problem is not really the position of the number, it is rather inserting a variable number of commas there.