System::StringComparer 类

StringComparer class

使用不同的比较模式比较字符串。此类的对象只能通过 System::MakeObject() 函数分配。切勿在栈上或使用 operator new 创建此类型的实例,因为这会导致运行时错误和/或断言故障。始终将此类包装在 System::SmartPtr 指针中,并使用该指针将其作为参数传递给函数。

class StringComparer : public virtual System::Object,
                       public System::Collections::Generic::IComparer<String>,
                       public System::Collections::Generic::IEqualityComparer<String>

方法

方法描述
Compare(args_type, args_type) const override使用当前设置比较两个字符串。
static Create(const System::SharedPtr<System::Globalization::CultureInfo>&, bool)创建特定文化的比较器。
Equals(String, String) const override使用当前设置检查两个字符串是否相等。
static get_CurrentCulture()当前文化比较器单例。
static get_CurrentCultureIgnoreCase()当前文化不区分大小写的比较器单例。
static get_InvariantCulture()不变文化比较器单例。
static get_InvariantCultureIgnoreCase()不变文化不区分大小写的比较器单例。
static get_Ordinal()序数比较器单例。
static get_OrdinalIgnoreCase()序数不区分大小写的比较器单例。
GetHashCode(String) const override获取字符串的哈希码。

Typedefs

类型定义描述
args_typeRTTI 信息。

另见