HP 3000 Manuals

strrchr [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Library Reference Manual

strrchr 

Locates the last occurrence of a supplied character within a string.

Syntax 

     #include <string.h.>
     char *strrchr(const char *s, int c);

Parameters 

s             A pointer to a null-terminated character string.

c             The value to find in the target string.

Return Values 

x             A character pointer to the last occurrence of c in string
              s.  This function returns a null pointer if the character
              is not found.

Description 

The strrchr function searches the null-terminated string s for the last
occurrence of c (converted to type char).  The terminating null character
is part of the string.

Example 

        while((ptr = strrchr(string, '@')) != NULL)
           *ptr = '#';

Replace all @'s with #'s, starting from the end of the array, working
backward toward the beginning.

See Also 

strchr(), strbrk(), ANSI C 4.11.5.5, POSIX.1 8.1



MPE/iX 5.0 Documentation