For i = 100 To 2 Step -1
MyStr = Trim$(Replace(MyStr, Space(i), Space(1)))
Next
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;)
For i = 100 To 2 Step -1
MyStr = Trim$(Replace(MyStr, Space(i), Space(1)))
Next
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;)
"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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.