Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.stsci.edu/~sontag/spicedocs/cspice/cposr_c.html
Дата изменения: Sat Dec 17 06:08:39 2005 Дата индексирования: Sun Apr 10 23:24:07 2016 Кодировка: |
Find the first occurrence in a string of a character belonging to a collection of characters, starting at a specified location, searching in reverse.
SCANNING
VARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- str I Any character string. chars I A collection of characters. start I Position to begin looking for one of chars. The function returns the index of the last character of str at or before index start that is in the collection chars.
str is any character string. chars is a character string containing a collection of characters. Spaces in chars are significant, including trailing blanks. The order in which characters are listed is not significant. start is the position in str to begin looking for one of the characters in chars. start may range from 0 to n-1, where n is the number of characters in str.
The function returns the index of the last character of str (at or before index start) that is one of the characters in the string chars. The returned value normally ranges from 0 to n-1, where n is the number of characters in str. If none of the characters is found, the function returns -1.
None.
cposr_c is case sensitive. An entire family of related CSPICE routines cpos_c cposr_c ncpos_c ncposr_c pos_c posr_c is described in the Required Reading.
Let string == "BOB, JOHN, TED, AND MARTIN...." 012345678901234567890123456789 Normal (sequential) searching: ------------------------------ cposr_c( string, ' ,', 29 ) = 29 cposr_c( string, ' ,', 28 ) = 28 cposr_c( string, ' ,', 27 ) = 27 cposr_c( string, ' ,', 26 ) = 26 cposr_c( string, ' ,', 25 ) = 19 cposr_c( string, ' ,', 18 ) = 15 cposr_c( string, ' ,', 14 ) = 14 cposr_c( string, ' ,', 13 ) = 10 cposr_c( string, ' ,', 9 ) = 9 cposr_c( string, ' ,', 8 ) = 4 cposr_c( string, ' ,', 3 ) = 3 cposr_c( string, ' ,', 2 ) = -1 start out of bounds: -------------------- cposr_c( string, ' ,', 230 ) = 29 cposr_c( string, ' ,', 30 ) = 29 cposr_c( string, ' ,', -1 ) = -1 cposr_c( string, ' ,', -10 ) = -1
None.
1) The error SPICE(NULLPOINTER) is signaled if either of the input string pointers is null. 2) If start is less than 0, cposr_c returns -1. 3) If start is greater than or equal to the length of the string, the search begins at the last character of the string. 4) The function returns -1 if either of the input strings is empty.
None.
N.J. Bachman (JPL) W.L. Taber (JPL)
None.
-CSPICE Version 1.0.0, 27-AUG-2002 (NJB) (WLT)
backward search for position of character