Hi Folks,
I've just been showing off VFP's great string handling capabilities to the class here in sunny Melbourne. Of course, I got side tracked and set a litle exercise to demo the difference between the - and + operators:
m.lcString1 = "Hello" + space(4)
m.lcString2 = "World" + space(2)
? "*" + m.lcString1 + m.lcString2 + "*"
? len("*" + m.lcString1 + m.lcString2 + "*")
? "*" + m.lcString1 - m.lcString2 + "*"
? len("*" + m.lcString1 - m.lcString2 + "*")
? "*" + m.lcString1 - space(1) + m.lcString2 - "*"
? len("*" + m.lcString1 - space(1) + m.lcString2 - "*")
Pretty normal sort of stuff
This returns:
18
18
19
where I would expect it to return
18
14
13
This occurs in VFP5 and 7.
From my reading of the docs, the - operator should "remove the trailing blanks from the element preceeding the operator, then join the two elements". What appears to be occurring is that the string is left the same length and the white space simply moved to the end.
Anyone else consider this to be a bug, either in the docs or the program?
Cheers,
Andrew
If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?
From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."
All my FoxTalk and other articles are available on my
web site.
Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.