Cicode Programming Reference > Cicode Function Categories > String Functions Introduction > StrToLines

StrToLines

Converts a string into separate lines that contain no more than the number of characters specified in the MaxChars argument.

The function splits the string by inserting newline characters into the text string, thus dividing it into separate lines. The string will be split at a whitespace character if possible, and that whitespace will be replaced by the newline character. If no whitespace characters are available then the insertion will be made at the maximum number of characters from the previous line break.

Syntax

StrToLines(String,MaxChars, nLines)

String:

The string to convert.

MaxChars:

The maximum number of characters permitted in each new line produced by the StrToLines() function.

nLines:

The number of lines produced by the StrToLines() function from the input string.

Return Value

An integer (nLines) containing the number of lines produced by the StrToLines() function from the input string.

Example

BrokenString=StrToLines("Was that a real Stegosaur?", 5, nLines);
!The function returns the value 6 in nLines, and Broken String now contains:
Was
that
a
real
Stego
saur?
BrokenString=StrToLines("It breaks the string by inserting newline characters into the text.", 16, nLines);
!The function returns the value 6 in nLines, and Broken String now contains:
It breaks the
string by
inserting
newline
characters into
the text.

See Also

String Functions