Converts spaces in tabs

        [<cCharacter|nCharacter>]) --> cString


     <cString>  Designates a character string that is packed with tab

     <nTabWidth>  Designates the tab width.  The default value is 8.

     <cCharacter|nCharacter>  Designates which characters are replaced by
     a tab.  The default value is a space, CHR(32).


     TABPACK() returns the modified character string.


     This function does not simply exchange a simple sequence of the same
     characters for a tab; instead, it takes into account the true tab
     positions.  If a space (or the <cCharacter|nCharacter>) is found at a
     tab position, and immediately preceding it there is at least one
     identical character, the function replaces this sequence (maximum
     <nTabWidth>) with a CHR(9).  With tab characters, text can be packed by
     individual tab widths.  As with every good text editor, there is no
     replacement with a tab within single or double leading characters.


     .  For the beginning of a line, the function takes into account
        the "normal" carriage return (CHR(13)/CHR(10)) as well as the high
        bit return (CHR(141)) used by MEMOEDIT().  Previously existing tab
        characters are also taken into account.

     .  If another tab already exists, this tab can be removed with
        TABEXPAND().  The new tab can then be inserted using TABPACK().


     We have avoided replacing spaces with tabs in the following examples to
     keep the example legible.  Tab width is 8 (default).  "*" is exchanged
     for tab characters.

     ? TABPACK("AAAAAAA*", "*")           // "AAAAAAA*"
     ? TABPACK("AAAAA***", "*")           // "AAAAA" + CHR(9)

     ? TABPACK("AAAAA*****", "*")         // "AAAAA" + CHR(9) + "**"
     crlf   :=  CHR(13) + CHR(10)
     cText  :=  "ABCD+" + crlf + "++---+++++"
     ? TABPACK(cText, 4, "+")             // "ABCD+" + crlf +
                                          // "++---" + CHR(9) + "++"



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.