How to make a string compare non case sensitive?

后端 未结 2 1377
情书的邮戳
情书的邮戳 2021-01-25 15:58

I am trying to write a code for one of those programs that responds according to your answers. I want to make it so that some of the variables are not case sensitive. For exampl

2条回答
  •  再見小時候
    2021-01-25 16:26

    I think there is no way to do no case sensitive variable. From your code you want to threat answers in strings into a switch and do some action that depends on answer.

    I think the best way is to take user input a use on that string upper method from string class.

    YourString =  YourString.toUpperCase();
    

提交回复
热议问题