Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String Concatenation with the - Operator
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
String Concatenation with the - Operator
Divers
Thread ID:
00674235
Message ID:
00674235
Vues:
48
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:
*Hello    World  *
18
*HelloWorld      *
18
*Hello     World*  
19
where I would expect it to return
*Hello    World  *
18
*HelloWorld  *
14
*Hello World*
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform