void cmprss_c ( SpiceChar delim,
ConstSpiceChar * input,
SpiceChar * output )
Compress a character string by removing occurrences of
more than N consecutive occurrences of a specified
ASCII, CHARACTER, STRING
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.
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
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.
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.
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
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.
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.
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]"
W.L. Taber (JPL)
I.M. Underwood (JPL)
N.J. Bachman (JPL)
-CSPICE Version 1.0.0, 20-AUG-1999 (WLT) (IMU) (NJB)
compress a character_string