User Tools

Site Tools


strings

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
strings [2018/08/19 18:10] wolfgangriedmannstrings [2018/10/06 05:09] (current) wolfgangriedmann
Line 22: Line 22:
  
 Of course you can use both at the same time: Of course you can use both at the same time:
-<code visualfoxpro>cString := ei"this is a \"string\". that references {cLocalVar}"</code>+<code visualfoxpro>cString := ei"this is a \"string\". that references {cVariableName}"</code>
  
 As variable, not only a string variable can be used, but every type of object, and under the houd the '':ToString()'' method is called: As variable, not only a string variable can be used, but every type of object, and under the houd the '':ToString()'' method is called:
Line 29: Line 29:
  
 cString := i"This is {oPerson}"</code> cString := i"This is {oPerson}"</code>
 +
 +And if you wish, you can also use formatting expressions:
 +
 +<code visualfoxpro>local nValue as decimal
 +
 +nValue := 123.45m
 +cString := i"nValue: {nValue:######.0000}" // nValue: 123,4500
 +cString := i"nValue: {nValue:F6}" // nValue: 123,450000</code> 
 +
 +In this case (as in the use with ToString()), if you need to embed the parentheses ''{'' and ''}'' in your string, they need to be doubled as in this sample:
 +<code visualfoxpro>cConnection := i"Driver={{Microsoft access Driver (*.mdb)}};Dbq={cDatabaseFile};Uid=Admin;Pwd=;"</code>
  
 And only in the VO dialect, you need to prefix a char with the ''c'' prefix: And only in the VO dialect, you need to prefix a char with the ''c'' prefix:
 <code visualfoxpro>cChar := c'a'</code> <code visualfoxpro>cChar := c'a'</code>
 +
 +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 ''@'' character.
 +In X# all strings are normal, and to be enhanced, they need the ''e'' prefix.
  
  
strings.1534702214.txt.gz · Last modified: 2018/08/19 18:10 by wolfgangriedmann