Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

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
", exclamationCheck);
  return 0;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #string #character
ADD COMMENT
Topic
Name
6+1 =