Commands and Statements

Command TEXT Foundation

Displays, outputs or assigns literal text.

Syntax
TEXT [TO PRINTER] | [TO FILE <cFilename>]
   <Text>
ENDTEXT
or 
TEXT [INTO <variable> [TRIMMED]] |
     [INTO <variable> WRAP] |
     [INTO <variable> WRAP <cLineBreak> [TRIMMED]]
   <Text>
ENDTEXT
Parameters
FILE <cFilename>
<cFilename> indicates the name of a file where the text <Text>is optionally written. The name must contain the drive and path, if necessary. The file name can be specified either as a literal file name or as a character expression in parentheses. When the file name is specified without file extension, ".TXT" is used by default.
PRINTER
Indicates that the text should be sent to the printer instead to a file.
<variable>
<variable> indicates the <Text> is to be stored into a variable.
<cLineBreak>
The optional parameter <cLineBreak> specifies a character string that is used to wrap lines. The default value is CHR(13)+CHR(10) (carriage return and line feed). If WRAP is not specified, no line breaks will be inserted.
TRIMMED
This optional parameter tells the preprocessor to remove all spaces from the beginning of the line if TEXT INTO .. is used.
<Text>
<Text> is the text to output. The text to output is delimited from the rest of the source code by the key words TEXT...ENDTEXT.
Description

The command TEXT...ENDTEXT designate a block of text in the source code which is to be output to the screen, the printer, a file or to be assigned to a variable. Macro variables are replaced, but not macro expressions. To suppress output on the screen, the command SET CONSOLE OFF must be executed before this command is called, unless TEXT INTO is used.

The text is output as it appears in the source code, including indentation using blank spaces or tab characters. If TEXT INTO .. TRIMMED is used, the text will be left trimmed, ie. spaces will be removed from the left side.

Examples
TEXT INTO .. WRAP
// In the example, TEXT...ENDTEXT is used to save 
// literal text to a variable. 

PROCEDURE Main() 
LOCAL cHtml, cText 

      TEXT INTO cHtml WRAP 
           <table width="710" border="2"> 
             <tr bgcolor="#000066"> 
              <td width="224">Hi 
              </td> 
             </tr> 
           </table> 
      ENDTEXT 
      /* The cHtml contains the text as found in the 
       * source code using default line breaks 
       */ 
      OutStd(cHtml) 

      TEXT INTO cText WRAP ";" TRIMMED 
          Thank you for purchasing our product. 
          Please register your software to benefit 
          from the 30 days of free technical support 
          and to receive the latest information about 
          our products. 
      ENDTEXT 
      /* The cText variable contains text that has no spaces on the 
       * left side and the line break character conforms to the format 
       * expected by Alert(). 
       */ 
      Alert(cText) 
RETURN 
TEXT
// In the example, TEXT...ENDTEXT is used for output of 
// help text which describes the correct way to call the 
// program from the command line. 

PROCEDURE Main( cUserID, cMaxRow ) 

   IF PCount() == 0 
      CLS 
      TEXT 
      To execute use:Testprog  <UserID> [ 25 | 43 | 50 ] 

              <UserID> - User identification 
              [Number] - Number of lines in the window 
      ENDTEXT 
      QUIT 
   ENDIF 

   IF PCount() == 2 
      SetMode( Val(cMaxRow), 80 ) 
   ENDIF 

   ? "User ID:", cUserID 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.