首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::sub_match::compare

int compare( const sub_match& m ) const;

(1)

(since C++11)

int compare( const string_type& s ) const;

(2)

(since C++11)

int compare( const value_type* c ) const;

(3)

(since C++11)

1%29比较两sub_match直接通过比较它们的潜在字符序列。相当于str().compare(m.str())...

2%29比较asub_match带着std::basic_string相当于str().compare(s)...

3%29比较asub_match中指向的基础字符类型的空结束序列。s相当于str().compare(c)...

应用程序代码很少直接使用此函数。相反,使用非会员比较运算符之一。

参数

m

-

a pointer to another sub_match

s

-

a pointer to a string to compare to

c

-

a pointer to a null-terminated character sequence of the underlying value_type to compare to

返回值

值小于零,如果这个子[医]匹配再少点比其他字符序列,如果两个下面的字符序列相等,则为零,如果此子字符序列大于零。[医]匹配更大比其他字符序列。

另见

compare

compares two strings (public member function of std::basic_string)

stroperator string_type

converts to the underlying string type (public member function)

operator==operator!=operator<operator<=operator>operator>=

compares two sub_match objects (function template)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com