strings
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| strings [2018/02/14 05:13] – wolfgangriedmann | strings [2018/10/06 05:09] (current) – wolfgangriedmann | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| A string in X# is delimited by the double quotation mark: | A string in X# is delimited by the double quotation mark: | ||
| - | < | + | < |
| This is valid for the VO, Vulcan and Code dialects. In the VO dialect a string can also be delimited by the single quotation mark: | This is valid for the VO, Vulcan and Code dialects. In the VO dialect a string can also be delimited by the single quotation mark: | ||
| - | < | + | < |
| This is to make X# compatible to VO code. | This is to make X# compatible to VO code. | ||
| If you need to use special characters or double quotation mark in your string, the enhanced string does what you need: | If you need to use special characters or double quotation mark in your string, the enhanced string does what you need: | ||
| - | < | + | < |
| and of course you can also embed other control characters in your string: | and of course you can also embed other control characters in your string: | ||
| - | < | + | < |
| But you can do even more with interpolated strings: | But you can do even more with interpolated strings: | ||
| - | < | + | < |
| cString := i" | cString := i" | ||
| Of course you can use both at the same time: | Of course you can use both at the same time: | ||
| - | < | + | < |
| + | |||
| + | As variable, not only a string variable can be used, but every type of object, and under the houd the '': | ||
| + | |||
| + | <code visualfoxpro> | ||
| + | |||
| + | cString := i"This is {oPerson}"</ | ||
| + | |||
| + | And if you wish, you can also use formatting expressions: | ||
| + | |||
| + | <code visualfoxpro> | ||
| + | |||
| + | nValue := 123.45m | ||
| + | cString := i" | ||
| + | cString := i" | ||
| + | |||
| + | In this case (as in the use with ToString()), | ||
| + | <code visualfoxpro> | ||
| And only in the VO dialect, you need to prefix a char with the '' | And only in the VO dialect, you need to prefix a char with the '' | ||
| - | < | + | < |
| + | |||
| + | Please note that there is a major difference between C# and X#: in C# all strings are enhanced, and to make them normal, you must prefix them with the '' | ||
| + | In X# all strings are normal, and to be enhanced, they need the '' | ||
strings.1518585186.txt.gz · Last modified: 2018/02/14 05:13 by wolfgangriedmann