MLcToPos Function | |
Return the position of a character in a formatted string.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax FUNCTION MLcToPos(
cText AS STRING,
nWidth AS DWORD,
nLine AS DWORD,
nCol AS DWORD,
nTabSize AS DWORD,
lWrap AS LOGIC
) AS DWORD
public static uint MLcToPos(
string cText,
uint nWidth,
uint nLine,
uint nCol,
uint nTabSize,
bool lWrap
)
Request Example
View SourceParameters
- cText
- Type: String
A string. - nWidth
- Type: DWord
The length of each line after cText is formatted.
- nLine
- Type: DWord
The line number in the formatted text, starting from the top at 1. - nCol
- Type: DWord
The column number in the formatted text, starting from the left at 0. - nTabSize
- Type: DWord
The number of characters to insert when the user presses Tab.
If nTabSize is not specified, 4 spaces are inserted.
- lWrap
- Type: Logic
The word-wrap flag.
The default is TRUE.
Return Value
Type:
DWord
The byte position of the character within
cText, counting from 1.
Remarks
MLCToPos() determines the character position that corresponds to a particular line and column within formatted text. Note that the line number is 1-relative, and the column number is 0-relative.
This is compatible with MemoEdit().
The return value is 1-relative, making it suitable for use in Substr() or other string functions.
MLCToPos() is used with MPosToLC() to create search routines or other text processing for MemoEdit().
Examples
This example gives the current position of the character that will appear in line 3, column 0 when
cText is formatted with a line length of 5 characters:
1cText := "Note the side on which the bread" + "is buttered."
2? MLCToPos(cText, 5, 3, 0)
See Also