SpiceInt lastnb_c ( ConstSpiceChar * string )
Return the zero based index of the last non-blank character in
a character string.
None.
ASCII, CHARACTER, SEARCH
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
string I Input character string.
The function returns the zero-based index of the last non-blank
character in a character string.
string is the input character string.
The function returns the zero-based index of the last non-blank
character in a character string. If the string is entirely blank
or is empty, the value -1 is returned.
None.
1) If the input string pointer is null, the error
SPICE(NULLPOINTER) will be signaled.
None.
If the string is blank or null, return -1. Otherwise, step through
the string one character at a time until something other than
a blank is found. Return the zero based index of that something
within the string.
Note that if the length of the string to the last non-blank
character is of interest, that value is the returned value plus one.
The following examples illustrate the use of lastnb_c.
last = lastnb_c ( "ABCDE" );
last is 4
last = lastnb_c ( "AN EXAMPLE" );
last is 9
last = lastnb_c ( "AN EXAMPLE " );
last is 9
last = lastnb_c ( " " )
last is -1
None.
None.
N.J. Bachman (JPL)
K.R. Gehringer (JPL)
I.M. Underwood (JPL)
E.D. Wright (JPL)
-CSPICE Version 1.1.0, 27-AUG-1999 (NJB)
Added check for null input string. Added some further comments
to the Brief_I/O and Detailed_Output header sections.
-CSPICE Version 1.0.0, 08-FEB-1998 (KRG) (IMU) (EDW)
last non-blank character
Link to routine lastnb_c source file lastnb_c.c
|