Function PPSplitLine() Professional
Splits a multi-line into an array of single lines
PPSplitLine( <cLine> ) --> aMultipleLines
The return value of PPSplitLine() is a one-dimensional array containing the splitted lines.
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.
// 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
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.