-1

I have a winform application and I was wondering what is the c# code to validate both lowercase and uppercase input for string search comparison.Thank you.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
Dominique1256
  • 85
  • 1
  • 9

1 Answers1

3

One way is to use the method in the string class ToUpper() or ToLower() before validation.

Something like

string inputString = "inputfoo";

if (inputString.ToUpper() == "INPUTFOO"){
  //do something, this is going to be executed
}

you can also check ToLower(), ToLowerInvariant, and ToUpperInvariant methods for further choices.

Ian
  • 30,182
  • 19
  • 69
  • 107