Questions tagged [strstr]

A function that searches a string in another string.

A function that searches a string in another string.

Examples

php
$email  = 'name@example.com';
$domain = strstr($email, '@');
echo $domain; // prints @example.com

(Example taken from php.net)

Resources

363 questions
-5
votes
1 answer

Input two character strings a and b, please count how many times b appears in a

I have a problem writing the code to this problem and i can't seem to wrap my head around on how to do it. It's for my university assignment and I've tried a program that gives the same output but still says i got the wrong answer. For…
-5
votes
2 answers

strstr with regular char array , not strings

I tried to create a function which works the same as strstr , but with char arrays instead of strings and returning 1 if the first array is in the second array (the programming language is c). I have the declaration of the function added.int…
KorenX
  • 5
  • 4
-5
votes
2 answers

Cutting ' \0' from strings

I have a 2D array of strings loaded with getline from stdin example : Hi my name is John. I like chocolate. Then i want to search if entered string / substring matches with one of the string arrays example : Ohn. - matches at line 1 chocolate. -…
paxie
  • 137
  • 1
  • 2
  • 9
1 2 3
24
25