c - How do I check if a string is contained in another string? -



c - How do I check if a string is contained in another string? -

this question has reply here:

check substring exists in string in c 7 answers

example in python:

>>> a="sweet potato" >>> "potato" in true

i thought might strcmp, strcmp must identical match, no?

strcmp used determined if 2 string identical.

if want find if string contain sub string there severel way. 1 alter mann wrote:

if (strstr(str, "potato")) puts("true");

c substring string-comparison

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -