CARM User's Guide

Discontinued

strrpos

Summary
#include <string.h>

unsigned int strrpos (
  const unsigned char *string,   /* string to search */
  char c);                       /* character to find */
Description

The strrpos function searches string for the last occurrence of c. The null character terminating string is included in the search.

Return Value

The strrpos function returns the index of the last character matching c in string or a value of -1 if no matching character was found. The index of the first character in string is 0.

See Also

strchr, strcspn, strpbrk, strpos, strrchr, strrpbrk, strspn

Example
#include <string.h>
#include <stdio.h> /* for printf */

void tst_strrpos (const unsigned char *s) {
  unsigned int i;

  i = strrpos (s, ' ');

  if (i == -1)
    printf ("No spaces found in %s\n", s);
  else
    printf ("Last space in %s is at offset %d\n", s, i);
}