strchr( const char *source, char c )
Returns the first occurrence of c
in source
, or
NULL
if not found.
char *strchr( const char *source, char c ) { while ( *source ) { if ( *source == c ) { return source; } } return NULL; }
There's also strrchr
which finds the last occurence.