INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Trimming dots from a value [Solved]  (Read 1001 times)

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Trimming dots from a value [Solved]
« 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.
Logged

Henglander

  • Recent member
  • *
  • Posts: 47
Re: Trimming dots from a value
« Reply #1 on: September 21, 2013, 12:49:57 pm »

How about RemoveCharacters([Album],.,2)?
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: Trimming dots from a value
« Reply #2 on: September 21, 2013, 12:53:37 pm »

I overlooked that one, thanks!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Trimming dots from a value
« Reply #3 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.
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up