For i = 100 To 2 Step -1
MyStr = Trim$(Replace(MyStr, Space(i), Space(1)))

I dont understand:sad: the part where "Step -1" is used, and this part:
"(MyStr, Space(i), Space(1)))"

plz help explaining this to me. THx in advance;)

10 Years
Discussion Span
Last Post by scudzilla

"Step -1" means that for every loop, the integer 'i' will be decreased by 1 until such time that 'i' will be equal to 2.

For MyStr = Trim$(Replace(MyStr, Space(i), Space(1))) ... It means that all Space(i) string within the value of MyStr will be replaced by the string Space(1) and then the new string will be assigned to MyStr. Unless "Space" is a string array (which I don't know if possible), the code doesn't make sense at all because all the code will do is replace all multiple space characters into a single space characters. :?:


thx for the reply
1 more question:
does "Space" need to be declared?
or is Space a built in function of VB


I'm not sure whether Space is the same as Space$. What I know is that Space$ doesn't need to be declared. It is built in and can be called anytime.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.