Click or drag to resize

MLine Function (String, DWord, DWord)

X#
Extract a line of text from a string, specifying an optional offset argument.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION MLine(
	cString AS STRING,
	nLine AS DWORD,
	nOffset REF DWORD
) AS STRING
Request Example View Source

Parameters

cString
Type: String
The string that contains the line of text.
nLine
Type: DWord
The line number to extract.
nOffset
Type: DWord
The position from which to extract characters.
An offset of 0 corresponds to the first byte in cString.
This is the default.
Alternatively, nOffset may be passed by reference (preceded by an @) in which case, after the function call, it will contain the size of the returned line.

Return Value

Type: String
The specified line.
If the specified line does not exist, the return value is a NULL_STRING.
A new line begins when a hard-carriage return is encountered.
Remarks
Examples
This example uses MLine(), to extract the first line that is past offset 10 (the 11th character).
X#
1? MLine(Customer->Memos, 1, 10)
This example applies MLine() to a string that has two lines:
X#
1? MLine(Space(30)+Chr(13)+Space(40), 1)
2// Returns the first line (Space(30))
This example passes nOffset by reference:
X#
1nOffset := 0
2? MLine(Space(30)+Chr(13)+Space(40), 1, @nOffset)
3    // Space(30)
4? nOffset                // 30
See Also