Question : check if string contains a character in c
Answered by : oskari-lehtinen
#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;
}
Source : https://stackoverflow.com/questions/58146750/how-do-i-check-if-a-string-contains-a-certain-character | Last Update : Wed, 04 May 22
Question : check if string in string c
Answered by : adventurous-albatross
if(strstr(sent, word) != NULL) { /* ... */
}
Source : | Last Update : Sun, 01 Mar 20