EAGLE Help Light

strchr()

Funkce
Scans a string for the first occurrence of a given character.

Zápis
int strchr(string s, char c);

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

Viz také strrchr, strstr

Příklad


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


OBSAH Translation © 2001 ELCAD v.o.s., Copyright © 2001 CadSoft Computer GmbH