INTERACT FORUM

More => Old Versions => Media Center 14 (Development Ended) => Topic started by: raym on July 11, 2009, 01:59:25 am

Title: Expression help needed: removing leading spaces?
Post by: raym on July 11, 2009, 01:59:25 am
I'm trying to use the Replace(...) function to remove spaces from the start of a field but it's not working. For example,

Replace(xxxABBA,x) returns "ABBA"

But,

Replace(   ABBA, ) still returns "   ABBA"

I've tried putting single and double quotes around the space/search char eg, Replace(   ABBA,' ') but nothing seems to work.

How can I strip leading spaces? I was expecting a Trim() type function but Replace() seems to be my best bet.

Thanks for any help on this.
Title: Re: Expression help needed: removing leading spaces?
Post by: gappie on July 11, 2009, 03:45:15 am
hey raym,

you could use
replace([artist],/ )
note the slash. it makes the space behind it work.

the expression also removes the spaces between words, dont know if that is what you are after..

what works better is

clean([artist])

 8)
gab
Title: Re: Expression help needed: removing leading spaces?
Post by: raym on July 11, 2009, 04:29:56 am
Oh, perfect! Both solutions work. Didn't even know about Clean!!

Thanks again.
Title: Re: Expression help needed: removing leading spaces?
Post by: fitbrit on July 11, 2009, 06:13:35 pm
Am I mistaken in that this is one of the functions to be found in "Clean file properties" under the Library tools section of the contextual menu? Mind you it does simultaneously clean up trailing spaces too - if it finds them - so that may not be what you want.