How to define "Menu" and "menu" in the same statement?

For example, some people will type it like " Menu " and others want to type it as " menu "

I tried a few variations like…

if (input == "Menu" "menu")
if (input == "Menu", "menu")
if (input == "Menu, menu")if (input == "Menu" + "menu")

But no luck of any of these

The simplest approach would be to convert the user entered string to uppercase (or lowercase if you prefer).
You’ll then only have to check for “MENU” and none of the other crazy variants that users might enter.

This would look something like:

if(input.ToUpper() == "MENU")
{
    //do stuff
}

I hope that helps.

2 Likes

Hi Gary,

Fantastic, that did just the trick! Thank you very much for the help. Input.ToUpper/ToLower is gonna be very useful as I know people type in their own way, this essentially acts as a catch all.

Much appreciated :smiley:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms