void cmprss_c ( SpiceChar delim,
SpiceInt n,
ConstSpiceChar * input,
SpiceInt lenout,
SpiceChar * output )
Compress a character string by removing occurrences of
more than N consecutive occurrences of a specified
character.
None.
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
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.
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.
None.
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.
None.
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]"
None.
None.
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
Link to routine cmprss_c source file cmprss_c.c
|