Index Page
cspice_cmprss
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_CMPRSS compresses a character string by truncating 
   occurrences of more than 'n' consecutive occurrences of a 
   specified character to 'n' occurrences.

   For important details concerning this module's function, please refer to
   the CSPICE routine cmprss_c.

I/O

   
   Given:
   
       delim   a character used as a delimiter in string
               'input'
               
       n       a scalar integer identifying the maximum
               number of sequential 'delim' characters
               allowed in string 'input'
               
       input   a scalar string to compress
   
       The routine allocates memory for the 'output' string based on
       the length of the 'input' string. An 'input' string with length
       zero is an no-op.
   
   the call:
   
      cspice_cmprss, delim, n, input, output
   
   returns:
   
      output   a copy of 'input' with all occurrences
               of more than 'n' consecutive 'delim' removed
   
   IDL native code to perform the same operation (whitespace only):
   
      Remove all instances of a whitespace.
      output = strcompress( input, /REMOVE_ALL )
   
      Remove all but one instance of a whitespace.
      output = strcompress( input )
   
   Note: strcompress accepts vector arguments.
   

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   
      strings = [ 'ABC...DE.F...',  $
                  '...........',   $
                  '.. ..AB....CD' ]
   
      ;;
      ;; Compress multiple occurrences of '.'
      ;; in the strings array. Compress to
      ;; two periods...
      ;;
      cspice_cmprss, '.', 2, strings[0], output
      print, output
   
   IDL outputs:
   
      ABC..DE.F..
   
      ;;
      ;; ...three periods...
      ;;
      cspice_cmprss, '.', 3, strings[1], output
      print, output
   
   IDL outputs:
   
      ...
   
      ;;
      ;; ...one period.
      ;;
      cspice_cmprss, '.', 1, strings[2], output
      print, output
   
   IDL outputs:
   
      . .AB.CD
   
      ;;
      ;; Use the call to remove trailing, leading, and 
      ;; embedded spaces.
      ;;
      cspice_cmprss, ' ', 0, ' Embe dde d -sp   a c  es   ', output 
      print, output
   
   IDL outputs:
   
      Embedded-spaces

Particulars


   None.

Required Reading


   ICY.REQ

Version


   -Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)

Index_Entries

 
   compress a character_string 
 



Wed Apr  5 17:57:59 2017