Function PPSplitLine() Professional

Splits a multi-line into an array of single lines

Syntax
PPSplitLine( <cLine> ) --> aMultipleLines
Parameters
<cLine>
<cLine> is a character string.
Return

The return value of PPSplitLine() is a one-dimensional array containing the splitted lines.

Description

Many PreProcessor commands or translates transform a simple command into a series of function calls, method calls or even conditional statements spread over multiple lines. The function PPSplitLine() parses the output string of the PreProcessor for line breaks (marked by a semicolon) and puts them separated into elements of an one-dimensional array. The function takes care of the semicolon only outside of literals, such as string literals.

Examples
Break line into multiple lines
// This sample shows how to split 
// one line containing multiple statements into 
// separate lines 
#include "xpppp.ch" 
#pragma library("aspapib.lib") 

PROCEDURE Main 
LOCAL cMulti 
LOCAL aLines 
LOCAL cInput 
      
      IF PreprocessorInstall("std.ch") != XPP_ERR_NONE 
         QUIT 
      ENDIF 

      ? cInput := "SET INDEX TO ( cAppPath + cNtxName )" 
      PreProcessLine(cInput, @cMulti) 

      ? cMulti 

      // cMulti should now contain: 
      // "ordListClear() ;ordListAdd( ( cAppPath + cNtxName ) )" 
  
      ? aLines := PPSplitLine(cMulti) 
      /* 
       * aLines now contains two elements: 
       * aLines[1] => "ordListClear() " 
       * aLines[2] => "ordListAdd( ( cAppPath + cNtxName ) )" 
       */ 
      PreprocessorUninstall() 
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.