Advertisement
hocikto19

case insensitive funkcia strstr

May 2nd, 2015
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. /*case insensitive funkcia strstr*/
  2. char* mystrstr(char *seno, char *ihla){
  3.     char *s, *i;
  4.     if (!*ihla)
  5.         return seno;
  6.     for (; *seno; seno++){
  7.         if (toupper(*ihla) == toupper(*seno)){
  8.             s = seno;
  9.             i = ihla;
  10.             while (*i && *s){
  11.                 if (toupper(*i) != toupper(*s))
  12.                     break;
  13.                 i++;
  14.                 s++;
  15.             }
  16.             if (!*i)
  17.                 return seno;
  18.         }
  19.     }
  20.     return NULL;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement