I am trying to concatenate two Strings to one String. The new concatenated String should not consists of any whitespaces (blanks). When I try to put together two Strings (with “+” or “&”), a blank is added to the new String.
For example:
mYear = Right(Str(Year(Today())),2)
mMonth = Str(Month(Today()))
Select Case Cint(mMonth)
Case 1 To 9: xMonth = Fulltrim(“0” & mMonth)
End Select
mYearMonth = mYear & mMonth
Running this code on 13.4.2003, the Variable mYearMonth has a value of “030 4”. But it should have “0304”.
Subject: Whitespaces in String Concatenations
as already responded, numbers get leading spaces, you could try using the Format funtion instead, you may be able to get the formatted string in one go
Subject: Whitespaces in String Concatenations
this line is returning the space:
mMonth = Str(Month(Today()))
try
mMonth = trim(Str(Month(Today())))
This is the reason why from the help for str
“When LotusScript represents a positive number as a String, it inserts a leading space.”
Subject: Try mMonthYear = Format(Today, “yymm”)
Subject: RE: Try mMonthYear = Format(Today, “yymm”)
Thank you for the hints,Format(Today,“yymm”) is a real nice Function and does the Job in the best way.