OPTION FORMAT

Previous  Next

 

OPTION FORMAT ON/OFF

 


 

Turns string formatting on or off.  This will enable the usage of String Escape Sequences to be used in strings for printing.  Note that any Escape Sequences will be replaced so pay attention to paths etc.  In the example below we replace the single '\' with a double '\\' to avoid this problem.

 

The following Escape Sequences are recognized:

 

\n

\r

\t

\\

 

The MyBASIC2 Console requires a \r\n to be used for line breaks except end of line.

 

 

Example:

 

OPTION FORMAT ON

 

DIM s AS STRING

 

s = PATH.SessionVar( "%SourceFolder%\KALLE" )

s = STR.Replace( s, "\", "\\" )

PRINT "[";s;"]",

 

PRINT "\r\nNils Hult was here today\r\nKalle Anka was also here\r\n\r\nCool...\n"

 

 

This will produce the following output:

 

[D:\TECH\PROJECTS\COMMON\MYBASIC2\TEST FILES\KALLE]

 

Nils Hult was here today

Kalle Anka was also here

 

Cool...