Index Page cmprss_c
A B C D E F G H I J K L M N O P Q R S T U V W X
Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries
#### Procedure
       void cmprss_c ( SpiceChar          delim,
                       SpiceInt           n,
                       ConstSpiceChar   * input,
                       SpiceInt           lenout,
                       SpiceChar        * output  )
#### Abstract
        Compress a character string by removing occurrences of
        more than N consecutive occurrences of a specified
        character.
#### Required_Reading
       None.
#### Keywords
        ASCII,  CHARACTER,  STRING
#### Brief_I/O
        VARIABLE  I/O  DESCRIPTION
        --------  ---  --------------------------------------------------
        delim      I   Delimiter to be compressed.
        n          I   Maximum consecutive occurrences of delim.
        input      I   Input string.
        lenout     I   Available space in output string.
        output     O   Compressed string.
#### Detailed_Input
        delim       is the delimiter to be compressed out of the string.
                    This may be any ASCII character.

        n           is the maximum number of consecutive occurrences
                    of delim that will be allowed to remain in the
                    output string.

        input       is the input string.

        lenout      is the available space in the output string, counting
                    the terminating null.  lenout is typically the
                    declared length of the output string.
#### Detailed_Output
        output      is the output string. This is the input string with all
                    occurrences of more than N consecutive delimiters
                    removed.  A null terminator will follow the last
                    character of the string resulting from the compression.

                    If output is not large enough to hold the compressed
                    string, it is truncated on the right.  The output string
                    will always be null-terminated.

                    output may overwrite input.
#### Parameters
       None.
#### Exceptions
        1) If either input or output is a null pointer, the error
           SPICE(NULLPOINTER) will be signaled.

        2) If lenout is less than 1, the error SPICE(STRINGTOOSHORT) will
           be signaled.

        3) If the output string is too short to contain the result of
           compressing the input string, the result is truncated on the
           right.  The output string is still null-terminated.
#### Files
        None.
#### Particulars
        Occurrences of more than n consecutive delimiters are removed
        from the input string as it is copied to the output string.
        If the output string is not large enough to hold the compressed
        string, it is truncated on the right.
#### Examples
        Let DELIM = ".", and N = 2. Then

           "ABC...DE.F...",           becomes   "ABC..DE.F.."
           " ..........."                       " .."
           ".. ..AB....CD"                      ".. ..AB..CD"

        Let DELIM = " ", and N = 0. Then

           " DISK:[USER.  SUB  ]"     becomes   "DISK:[USER.SUB]"
#### Restrictions
        None.
#### Literature_References
        None.
#### Author_and_Institution
       W.L. Taber      (JPL)
       I.M. Underwood  (JPL)
       N.J. Bachman    (JPL)
#### Version
       -CSPICE Version 1.0.0, 20-AUG-1999 (WLT) (IMU) (NJB)
#### Index_Entries
       compress a character_string
#### Link to routine cmprss_c source file cmprss_c.c

    Wed Jun  9 13:05:20 2010