Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why does this work?
Message
From
21/09/2000 14:18:10
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00419138
Message ID:
00419203
Views:
18
Why not make this by the same way as in other languages?
For example, in SQL Server I can use following:
MyString = 'Ed''s new book "How to confuse FoxPro"'

In VFP I cannot make string constant that contains all ', " and [] characters :(

>>I have been looking through some code and have found the following:
>>
>>m.lookup = [ text text text ]
>>
>>When I tried this, it seems that it has made it a text variable.
>>
>>I have looked on MSDN library for some documentation on this, since I have never seen this, and could not find anything.
>>
>>Could anyone point me to documentation for this or explain when and why you would use the above?
>>
>
>VFP offers the option of encapsulating strings in three ways - using single quotes - ' text text text ', double quotes - " text text text " or matched pairs of square brackets - [ text text text ]
>
>The reason you'd choose one over the other is ease of use - if you wanted to place the phrase Ed's new book "How to confuse FoxPro" in a single string, and you didn't have the option of using square braces, you'd have to split up the string. You can do:
>
>cMyString = [Ed's new book "How to confuse FoxPro"]
>
>or
>
>cMyString = "Ed's new book " + '"How to confuse FoxPro"'
>
>to avoid having the parser misinterpret the string. It's a matter of flexibility, and has been a standard for Fox and other dBASE-derived languages for as long as I can remember.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform