EAGLE Help

strrchr()


Function
Scans a string for the last occurrence of a given character.

Syntax
int strrchr(string s, char c[, int index]);

Returns
The strrchr function returns the integer offset of the character in the string, or -1 if the character does not occur in the string.

See also strchr, strrstr

If index is given, the search starts at that position. Negative values are counted from the end of the string.

Example

string s = "This is a string";
char c = 'a';
int pos = strrchr(s, c);
if (pos >= 0)
   printf("The character %c is at position %d\n", c, pos);
else
   printf("The character was not found\n");

Index Copyright © 2005 CadSoft Computer GmbH