INTERACT FORUM

More => Old Versions => JRiver Media Center 19 for Windows => Topic started by: InflatableMouse on September 21, 2013, 08:25:30 am

Title: Trimming dots from a value [Solved]
Post by: InflatableMouse on September 21, 2013, 08:25:30 am
I'm using expressions to evaluate whether an album is located in the correct folder:

if(isequal(FileFolder([filename],0),/[[Year]/] clean([Album],3),8),Consistent, Inconsistent)

However, windows refuses to add trailing dots to a foldername so when I have an album ending with one or more dots, they show up as inconsistent.

Using Replace() doesn't work as it would also remove dots in the beginning or halfway a string.

Any tips on how I could trim a random number of dots from the end of an album name?

Thanks.
Title: Re: Trimming dots from a value
Post by: Henglander on September 21, 2013, 12:49:57 pm
How about RemoveCharacters([Album],.,2)?
Title: Re: Trimming dots from a value
Post by: InflatableMouse on September 21, 2013, 12:53:37 pm
I overlooked that one, thanks!
Title: Re: Trimming dots from a value
Post by: MrC on September 21, 2013, 01:20:33 pm
You might find you need to remove other trailing items, in which case it will be easier to use a regex():

   regex(field, /#^(.+?)([.]*)$#/, 1)

Add additional characters if necessary along with the dot inside the brackets: e.g. [._].

The expression can be modified to remove sequences instead any characters in the class.