#include <string.h>
|
char *
strchr (const char *s, int c); |
char *
strrchr (const char *s, int c); |
The strrchr function is identical to strchr except it locates the last occurrence of c.
#include <string.h> #include <stdio.h> int main() { char one[50]; char* ret; strcpy(one,"abcd"); ret = strchr("abcd", 'c'); if(!strncmp(one+2,ret,1)) printf("\ 'c\ ' found in string \"abcd\"\n"); ret = strchr(one, 'z'); if(ret == NULL) printf("\ 'z\ ' not found in string \"abcd\"\n"); return 0; }
Output
c found in string "abcd" z not found in string "abcd"
© 2007-2009 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. |
|