Table of contents
lx4uns_c (Scan for unsigned integer)
void lx4uns_c ( ConstSpiceChar * string,
SpiceInt * last,
SpiceInt * nchar )
Scan a string from a specified starting position for the
end of an unsigned integer.
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
string I Any character string.
first I First character to scan from in string.
last O Last character that is part of an unsigned integer.
nchar O Number of characters in the unsigned integer.
string is any character string.
first is the location in the string to beginning scanning
for an unsigned integer. It is assumed that the
unsigned integer begins at `first'.
The normal range of first is 0 : strlen(string)-1.
last is the last character at or after `first' such that the
substring ranging from string[first] through
string[last] is an unsigned integer. If there is no such
substring, last will be returned with the value first-1.
If an unsigned integer is found, last will be in the
range is 0 : strlen(string)-1.
nchar is the number of characters in the unsigned integer that
begins at index first and ends at last. If there is no
such string nchar will be given the value 0.
1) If `first' is beyond either end of the string, then `last' will be
returned with the value first-1 and `nchar' will be returned
with the value 0.
2) If string[first] is not part of an unsigned integer then
`last' will be returned with the value first-1 and `nchar' will be
returned with the value 0.
3) If the `string' input string pointer is null, the error
SPICE(NULLPOINTER) is signaled.
4) If the input string has length zero, `last' will be set to first-1
and `nchar' will be set to zero. This case is not considered an
This routine allows you to scan forward in a string to locate an
unsigned integer that begins on the input character first. An
unsigned integer is simply a sequence of digits.
1) Suppose you believe that a string has the form
where X, Y, and Z are unsigned integers of some unknown
length and % stands for some non-digit character. You could
use this routine to locate the unsigned integers in the
string as shown below. We'll keep track of the beginning and
ending of the unsigned integers in the integer arrays b and e.
first = 0;
i = 0;
len = strlen(string);
while ( first < len-1 )
lx4uns_c ( string, first, &last, &nchar );
if ( nchar > 0 )
b[i] = first;
e[i] = last;
first = last + 2;
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
W.L. Taber (JPL)
-CSPICE Version 1.0.1, 04-AUG-2021 (JDR)
Edited the header to comply with NAIF standard.
-CSPICE Version 1.0.0, 11-AUG-2002 (NJB) (WLT)
Scan a string for an unsigned integer.