Case Sensitive

Is there any way to allow input to be lowercase and still allow for transition if the matching parameter is uppercase? …I am thinking any other way besides writing an explicit OR (||) if statement… that can get long and messy

…I found the string.toUpper function but I am looking for it to be of a character function type. My options are in char type and not string.

Current Logic:

if (startState.letterForNextState.Contains(input[0]))
{
startState = startState.nextState[Array.IndexOf(startState.letterForNextState, input[0])];
Terminal.ClearScreen();
Terminal.WriteLine(startState.GetStateStory());
}

The logic works but it is case sensitive

Hi Randy,

If the spelling does not matter, you could simply use ToUpper() or ToLower() depening on the goal.

For instance, if startState.letterForNextState was “N” and the user input gets assigned to a variable named input, you could call input.ToUpper(). If the user types “n”, “N” will be assigned to the variable. This also works with char.

Is this what you wanted to know?


See also:

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

Privacy & Terms