Serching strings

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
Sehaf
Regular
Posts: 58
Joined: Thu Feb 25, 2010 9:22 pm
Projects: Demon Lord & Yuki Academy
Deviantart: Sehad
Location: Sweden
Contact:

Serching strings

#1 Post 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?

Tried:

Code: Select all

if "Lego" of "lego" in yc:
    p "LotR fan are you?"
But then it trigered no mather what I wrote.
I'm a GameMaker!
My Portfolio: http://www.bluepipestudio.com

Errilhl
Regular
Posts: 164
Joined: Wed Nov 08, 2017 4:32 pm
Projects: HSS
Deviantart: studioerrilhl
Github: studioerrilhl
Contact:

Re: Serching strings

#2 Post by Errilhl »

Code: Select all

if "LEGO" in yc.upper():
#or
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.
Currently working on: Image

Post Reply

Who is online

Users browsing this forum: No registered users