Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - strpack() pack a string http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 strpack()           Pack a string
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char strpack extern
   param const char cString

 Arguments
   cString is a string to pack.

 Return
   The packed version of cString.

 Description
   The strpack() function packs a string by replacing its repetitive
   stretches (consisting of more than three identical characters) by a
   three-character code. The packed string can be unpacked by the
   strunpack() function.

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   proc Test_strpack
   vardef
      char cString
      char cStringPacked
   enddef
   cString := "     Many......spaces     !"
   cStringPacked := strpack( cString )      // pack string
   ? len( cString ), cString                // original length is 27
   ? len( cStringPacked ), cStringPacked    // packed length is 20
   cString := strunpack( cStringPacked )    // unpack string
   ? len( cString ), cString                // restored length is 27
   endproc

   proc main
   Test_strpack()
   endproc

See Also: strunpack()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson