Return line and column position of a formatted string based on a specified
 byte position

     MPOSTOLC(<cText>, <nWidth>, <nPos>,
        [<nTabSize>], [<lWrap>]) --> aLineColumn


     <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.).


     MPOSTOLC() returns an array containing the line and the column values
     for the specified byte position, <nPos>.


     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.


     .  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.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.