Click or drag to resize

MemLines Function

X#
Count the number of lines in a string or memo field.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION MemLines(
	cString AS STRING
) AS DWORD
Request Example View Source

Parameters

cString
Type: String
The string in which to count.

Return Value

Type: DWord
The number of lines in cString, depending on the nLineLength, the nTabSize, and whether word wrapping is on or off.
Remarks
MemLines() is used with MemoLine() to print strings and memo fields based on the number of characters per line. In the basic operation, use MemLines() to return the number of lines in the string or memo field.
Then, using MemoLine() to extract each line, loop through the memo field until there are no lines left.
Examples
This example displays the contents of each Notes memo field in the SALES.DBF file, 1 line at a time:
X#
 1USE sales NEW
 2nLineLength = 65
 3DO WHILE !EOF()
 4    nLines = MemLines(Sales->Notes)
 5    FOR nCurrLine = 1 UPTO nLines
 6        ? MemoLine(Sales->Notes, nLineLength,;
 7                        nCurrLine)
 8    NEXT
 9    SKIP
10    ?
11ENDDO
See Also