MPOSTOLC() Return line and column position of a formatted string based on a specified byte position ------------------------------------------------------------------------------ Syntax MPOSTOLC(<cText>, <nWidth>, <nPos>, [<nTabSize>], [<lWrap>]) --> aLineColumn Arguments <cText> is a text string. <nWidth> is the length of the formatted line. <nPos> is the byte position within text counting from one (1). <nTabSize> is the number of columns between tab stops. If not specified, the default is four (4). <lWrap> is the word wrap flag. If not specified, the default is true (.T.). Returns MPOSTOLC() returns an array containing the line and the column values for the specified byte position, <nPos>. Description MPOSTOLC() is a memo function that determines the formatted line and column corresponding to a particular byte position within <cText>. Note that the line number returned is one-relative and the column number is zero-relative. This is compatible with MEMOEDIT(). <nPos> is one-relative, compatible with AT(), RAT(), and other string functions. MPOSTOLC(), used with MLCTOPOS(), can create search routines or other text processing for MEMOEDIT(). Refer to the source code for the program editor (PE.EXE) found in \CLIP53\SOURCE\PE directory. Examples . This example determines, for the text string shown, the line and column corresponding to the tenth character of the text, assuming a formatting width of five columns. A formatting width of five would cause each of the first three words to be placed on a line by itself. The tenth character of the text is the "s" in "side". The word "side" would be at the leftmost column of the third line of the formatted text, so the return value is {3, 0}. cText := "Note the side on which the bread ; is buttered." // aLC := MPOSTOLC(cText, 5, 10) // Result: {3, 0} Files Library is CLIPPER.LIB.
See Also: MEMOEDIT() MLCTOPOS() MLPOS()