Since version 11, it has been possible to store multi-line text in object variables. If you’ve ever used the
:PRINT
statement to print multi-line text, you have probably seen something like this:
2018-03-29 16:58:50 - U00020408 Multi-line variable: Line 1
Line 2
Line 3
If you want the output to be aligned, here’s a little hack. Define an object variable called
&NewLine#
and insert a single linefeed into the value. Then do something like this:
:SET &Header# = "&$LDATE_YYYY_MM_DD_d# &$TIME_HH_MM_SS# - U00020408
: "
:SET &String2# = STR_SUB(&
String
#,&NewLine#,"&NewLine#&Header#")
:PRINT "
Multi-line variable :
&String2#"
You should then see that the the lines line up.
2018-03-29 16:58:50 - U00020408 Multi-line variable : Line 1
2018-03-29 16:58:50 - U00020408
: Line 2
2018-03-29 16:58:50 - U00020408
:
Line 3
If you need to use the original unaltered variable elsewhere, be sure to write the altered text to a
new variable just for printing.