Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 winform 应用程序,我想知道用于验证字符串搜索比较的小写和大写输入的 c# 代码是什么。谢谢。
一种方法是在string类中ToUpper()或ToLower()验证之前使用该方法。
string
ToUpper()
ToLower()
就像是
string inputString = "inputfoo"; if (inputString.ToUpper() == "INPUTFOO"){ //do something, this is going to be executed }
您还可以检查ToLower()、ToLowerInvariant和ToUpperInvariant方法以获取更多选择。
ToLowerInvariant
ToUpperInvariant