rindex(3)

rindex3

Locate character in string

Usage

#include <strings.h>

char *

rindex(const char *s, int c);

Library

Standard C Library (libc, -lc)

Overview

The rindex() function locates the last character matching c (converted to a char) in the null-terminated string s.

Return values

A pointer to the character is returned if it is found; otherwise, NULL is returned. If c is ‘\0’, rindex() locates the terminating ‘\0’.

Releases

163 releases since Mac OS X 10.0; the text changed 3 times.

  1. 10.0–10.1.5
  2. 10.2–10.2.8
  3. 10.3–10.4.11
  4. 10.5–26.5

History

A rindex() function appeared in Version 6 AT&T UNIX. Its prototype existed previously in ⟨string.h⟩ before it was moved to ⟨strings.h⟩ for IEEE Std 1003.1-2001 (“POSIX.1”) compliance.

From Libc 1752.120.2 in macOS 26.5. Parsed by carta from the page's mdoc source.