[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
TABPACK()
Converts spaces in tabs
------------------------------------------------------------------------------
Syntax
TABPACK(<cString>,[<nTabWidth>],
[<cCharacter|nCharacter>]) --> cString
Arguments
<cString> Designates a character string that is packed with tab
characters.
<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).
Returns
TABPACK() returns the modified character string.
Description
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.
Notes
. 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().
Example
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) + "++"
See Also:
TABEXPAND()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson