[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   Function:   PackStr()

               PackStr() and it's complement, UnpackStr(), perform a simple
               Packing method on a character string (or memo). Both are
               written in Assembly and are thus very fast. There are no
               claims whatsoever on the quality of the packing method being
               used, It is a simple RLE (Run Length Encoding) Method.

               PackStr() and UnpackStr() could best be used on Memo variables
               that have quite a lot of repetitive characters (RLE method is
               as follows: when 4 or more of the same characters are
               encountered sequentially, they are packed into 3 chars) like
               forms, or screen lay-outs. PackStr() is NOT very useful on
               normal text when no much equivalent characters are encountered.

               Typically on forms, 30-40% of the original size of the string
               would be required, 80-99% of the original size would be required
               for normal text.

               PackStr() can be used on Memo fieds (ie. .DBT files), as it
               ensure's itself that it does not store an EOF character in the
               middle of the string.

               You should also conserve the length of the original string, as
               it is required by the UnpackStr() function. Not storing the
               length of the original string in the packed string was done on
               purpose, as you may want to use another method (see Example
               here).

   Syntax:     PackStr(<cStr>) --> cPackedStr

   Arguments:  <cStr> is the string to Pack. Memos and strings
               up to any length will be Packed.

   Returns:    The string, RLE packed.


   Usage:      /* Store a form in the Memo field of a database */
               /* First: Keep original length */
               Replace FORMLEN with Len(cForm)
               /* Now: Store the packed cForm */
               Replace FORM with PackStr(cForm)

               /* Later, Extract it as follows */
               ? cForm := UnpackStr(FORM,FORMLEN)

See Also: UnpackStr() EnCode()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson