Case sensitivity using st.text_input

I have a part in my app where an user has to search for a title to find it. If I write “Flowers Mansion” it will retrieve the result but not if I write “flowers mansion”. How can I implement this in streamlit … Any suggestion?

Hi @moonie_lovie, welcome to the Streamlit community!

This is a general programming pattern not necessarily related to Streamlit. When taking free-form text from the user, the program usually normalizes the text in some way:

user_text = st.text_input(...)

if user_text.lower() == 'flowers mansion':
elif user_text.lower() == 'something else':

In the above example, it won’t matter if the user writes Flowers Mansion, Flowers mansion, FLOWers MaNSion or any other combination of casing. Your comparison will only be against the lowercase version of the string.

Of course, in a situation where you know the input values, then you could also use a drop-down widget instead of having the user type in freeform text.