Using the LTRIM and RTRIM functions to eat up more than 1 blank space

13515
11
Jump to solution
03-22-2016 01:54 PM
ScottLouque
New Contributor III

I have 3 fields which I am concatenating together into a LABEL field

Pre_DIR, STR_NAME and SUFFIX

      X          XXXXX                XX

I am trying to use the LTRIM and RTRIM functions to eat up the blank spaces so the column lines up properly

My expression in the field calculator looks like this

RTRIM( [PRE_DIR]) & " " & LTRIM([STR_NAME]) & " " & [SUF_FIX]

but my column still looks like this

X  XXXXX XX

XXXXX XX

X  XXXXX XX

What is wrong with my function? Could someone point out to me Why is it not lining up along the left side of the column?

Thanks,

0 Kudos
11 Replies
DanPatterson_Retired
MVP Emeritus

Numpy has the best logic... two nothings, don't make a something

>>> import numpy as np
>>>
>>> a = np.NaN
>>> b = np.NaN
>>> a == b
False
>>> b == a
False
>>>
0 Kudos
TedKowal
Occasional Contributor III

You got vb there, I cannot think of any "direct" way of equating nothingness without producing an error.

0 Kudos