INTERACT FORUM

Please login or register.

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

Author Topic: Expression help needed: removing leading spaces?  (Read 1469 times)

raym

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3583
Expression help needed: removing leading spaces?
« 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.
Logged
RKM Smart Home - www.rkmsmarthome.com.au
Z-Wave Home Automation

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: Expression help needed: removing leading spaces?
« Reply #1 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
Logged

raym

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3583
Re: Expression help needed: removing leading spaces?
« Reply #2 on: July 11, 2009, 04:29:56 am »

Oh, perfect! Both solutions work. Didn't even know about Clean!!

Thanks again.
Logged
RKM Smart Home - www.rkmsmarthome.com.au
Z-Wave Home Automation

fitbrit

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4887
Re: Expression help needed: removing leading spaces?
« Reply #3 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.
Logged
Pages: [1]   Go Up