Answers for "check if string is in a string c"

C
4

check if string in string c

if(strstr(sent, word) != NULL) {
    /* ... */
}
Posted by: Guest on February-23-2020
0

check if string contains a character in c

#include <stdio.h>
#include <string.h>

int main(void)
{
  char str[] = "Hi, I'm odd!";
  int exclamationCheck = 0;
  if(strchr(str, '!') != NULL)
  {
    exclamationCheck = 1;
  }
  printf("exclamationCheck = %d\n", exclamationCheck);
  return 0;
}
Posted by: Guest on April-27-2022

Code answers related to "check if string is in a string c"

Code answers related to "C"

Browse Popular Code Answers by Language