IgnoreCase
属性指定在比较字符串时是否忽略大小写。该属性适用于
String.Equals
、
String.Compare
和
String.indexOf
方法。
public boolean IgnoreCase { get; set; }
true
:在比较时忽略大小写。
false
:在比较时区分大小写。
string s1 = "hello";
string s2 = "HELLO";// 默认情况下,字符串比较区分大小写
Console.WriteLine(s1.Equals(s2)); // false// 忽略大小写003eString.Compare 方法String.IndexOf 方法
本文地址:https://www.qianwe.com/article/bcf3fc18968407e5aa1b.html