Click or drag to resize

MLPos Function

X#
Determine the position of a line in a string.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION MLPos(
	cText,
	nWidth,
	nLine,
	nTabSize,
	lWrap
) AS DWORD CLIPPER
Request Example View Source

Parameters

cText (Optional)
Type: Usual
A string.
nWidth (Optional)
Type: Usual
The length of each line after cText is formatted.
nLine (Optional)
Type: Usual
The line number in the formatted text, starting from the top at 1.
nTabSize (Optional)
Type: Usual
The number of characters to insert when the user presses Tab.
If nTabSize is not specified, 4 spaces are inserted.
lWrap (Optional)
Type: Usual
The word-wrap flag.
The default is TRUE.

Return Value

Type: DWord
The character position of wLine in cString.
If wLine is greater than the number of lines in cString, MLPos() returns the length of cString.
Remarks
Examples
This example uses MLPos() to find the position of a specific line, given a line length of 40:
X#
1LOCAL cString AS STRING
2LOCAL wLine AS DWORD
3LOCAL wPosition AS DWORD
4cString = MemoRead("temp.txt")
5nLineLength = 40
6wLine = 5
7wPosition = MLPos(cString, nLineLength, wLine)
8? Substr(cString, wPosition, 12)
See Also