-3

Example in python:

>>> a="Sweet potato"
>>> "potato" in a
True

I thought it might be strcmp, but strcmp must be identical match, no?

Chris Maes
  • 35,025
  • 12
  • 111
  • 136
Realdeo
  • 449
  • 6
  • 19

1 Answers1

1

strcmp is used to determined if two string are identical.

if you want to find if a string contain a sub string there are severel way. a very good one is what Alter Mann wrote:

if (strstr(str, "potato")) puts("True");
No Idea For Name
  • 11,411
  • 10
  • 42
  • 70
  • 1
    I would go for `return strstr(str,"potato") != NULL`, but in either case, this answer does **not** deserve a down-vote. – barak manos Nov 11 '14 at 09:40