The fold() function folds a string expression into a string of a given length.
fold(str.exp, fold.length.exp{, delimiter})
str.exp | String to be folded. |
fold.length.exp | Length to which the string expression is folded. If omitted, it defaults to 25. Multiple numeric expressions, separated by value marks, can be specified in this parameter. |
delimiter | Delimiter used in the folded text. |
The text is folded (or wrapped) so the length of the first line is less than or equal to the value of the first numeric value in the fold.length.exp, the length of the second line is less than or equal to the value of the second numeric value in the fold.length.exp, and so on. If more strings exist than the 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 optional and defaults to char (253) if it is not specified. Only the first character of a provided delimiter is used.
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 a\test\string to\demonstrat\e "fold" a = fold(a,25,"")
or
delimiter = "" a = fold(a,25,delimiter)
In the first example a sub-value was specified and used, but in the second example a value mark is used by default as the fold delimiter.