Page 1 of 1

Serching strings

Posted: Thu Nov 30, 2017 5:52 pm
by Sehaf
Hi simple question really, but found no answers in search.

When the player is alowed to enter any text, I can check the text for key words

Code: Select all

if "Lego" in yc:
    p "LotR fan are you?"
Like so...

My question is, how do I have it check without bothering with if its capslock or not?


Code: Select all

if "Lego" of "lego" in yc:
    p "LotR fan are you?"
But then it trigered no mather what I wrote.

Re: Serching strings

Posted: Fri Dec 01, 2017 7:38 am
by Errilhl

Code: Select all

if "LEGO" in yc.upper():
if "lego" in yc.lower():
Basically, what you do is not checking for either lower or upper, but matching the content of the word against a uniform string, regardless of capitalisation.