I want to check, if a string exists in another string, but when I search for the string, I can only get a confirmation, when the string is exactly the same. How can I bypass that?
Asked
Active
Viewed 56 times
0
-
Convert both strings to the same case before checking if it exists. – Barmar Jan 23 '20 at 10:43
-
`string.lower()`? – Guy Jan 23 '20 at 10:43
1 Answers
0
Try this, it checks whether string is contained in string2 (case insensitive) after verifying they are different :
string != string2 and str.lower(string) in str.lower(string2)
![](../../users/profiles/2529954.webp)
EricLavault
- 5,766
- 2
- 19
- 33