Index Page lastnb_c

A B C D E F G H I J K L M N O P Q R S T U V W X

Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

       SpiceInt lastnb_c ( ConstSpiceChar * string )

#### Abstract

       Return the zero based index of the last non-blank character in
       a character string.

#### Required_Reading

       None.

#### Keywords

       ASCII,  CHARACTER,  SEARCH

#### Brief_I/O

       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.

#### Detailed_Input

       string     is the input character string.

#### Detailed_Output

       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.

#### Parameters

       None.

#### Exceptions

        1) If the input string pointer is null, the error
           SPICE(NULLPOINTER) will be signaled.

#### Files

       None.

#### Particulars

       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.

#### Examples

       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

#### Restrictions

       None.

#### Literature_References

       None.

#### Author_and_Institution

       N.J. Bachman    (JPL)
       K.R. Gehringer  (JPL)
       I.M. Underwood  (JPL)
       E.D. Wright     (JPL)

#### Version

       -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)

#### Index_Entries

       last non-blank character

#### Link to routine lastnb_c source file lastnb_c.c

    Wed Apr  5 17:54:38 2017