- Abstract
Compress a character string by removing occurrences of
more than N consecutive occurrences of a specified
character.
- Required_Reading
None.
- 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.
- 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.
- 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.
- Author_and_Institution
W.L. Taber (JPL)
I.M. Underwood (JPL)
N.J. Bachman (JPL)
- Literature_References
None.
- Version
-CSPICE Version 1.0.0, 20-AUG-1999 (WLT) (IMU) (NJB)
- Index_Entries
compress a character_string
- Link to routine source