How to use string.contains in this lines:
if not somestring.contains("Hello"): continue
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ashutosh GuptaRank #805 · 2.9K reputationPosted Dec 5, 2019, 6:39 PM EST
You can use the 'in' operator or the string’s 'find' method to check if a string contains another string. in operator check exact string with destination as mentioned by Rajanikant and find operator will find that string and return the index of it, if index is -1 then it does not contains else it return no negative value.
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Dec 5, 2019, 3:55 PM EST
Dipa MehtaRank #361 · 6.9K reputationPosted Dec 5, 2019, 8:23 PM EST
lene borma5 reputationPosted Feb 11, 2020, 5:44 PM EST
Regular Expression
Bhawna TutejaRank #2,418 · 584 reputationPosted Mar 17, 2020, 8:11 PM EDT