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

javascript - THREE.js reposition vertices for RingGeometry -

javascript - I need to update the text of a paragraph by inline edit -

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