basic.fold Function/BASIC Program

basic.fold

Command basic.fold Function/BASIC Program
Applicable release versions: AP
Category BASIC Program (486)
Description "folds" a string.expression into a string of a given length or lengths.

The "fold.length.expression" specifies the length(s) at which the string.expression will be folded. If the fold.length.expression is omitted, it defaults to 25. Multiple numeric expressions, separated by value marks, may be specified in this parameter.

The text is folded so the length of the first line is less than or equal to the value of the first numeric value in the fold.length.expression, the length of the second line is less than or equal to the value of the second numeric value in the fold.length.expression, and so on. If more strings exist than corresponding number of fold.length.expressions, the last fold.length.expression is applied to the remaining strings. If possible, the text is folded on a space.

The "delimiter" parameter is the delimiter used in the folded text. This parameter is required by the compiler, but the parameter may be null, in which case a value mark ( char(253) ) is used. See example 2.
Syntax fold(string.expression,fold.length.expression,delimiter)
Options
Example
equ svm to char(252)
input string
string=fold(string,10,svm)
print string

When the string:

this is a test string to demonstrate "fold"

is entered, the string is embedded with the requested subvalue marks as follows:

this is ateststring todemonstrate "fold"

a = fold(a,25,"")
-or-
delim = ""
a = fold(a,25,delim)

In both of these examples, a value mark is used as the fold delimiter.
Purpose
Related basic.statements
basic.occurs
basic.count
basic.functions