std::text_encoding::comp-name
来自cppreference.com
< cpp | text | text encoding
static constexpr bool /*comp-name*/( std::string_view a, std::string_view b ); |
(C++26 起) (仅用于阐述*) |
|
根据 Unicode 字符集别名匹配规则比较两个以普通字面量编码的字符串 a 和 b。
进行以下步骤后,两个字符串从左向右比较相等时,认为它们相等:
- 移除所有非字母数组字符,
- 将所有字母转为相同大小写,以及
- 移除任何没有紧跟数值前缀的 '0' 字符序列。数值前缀由一个非零数字('1' 到 '9')可选跟着一个或多个非字母数字字符构成。
以下为示例:
static_assert(/*comp-name*/("UTF-8", "utf8") == true); static_assert(/*comp-name*/("u.t.f-008", "utf8") == true); static_assert(/*comp-name*/("ISO-8859-1", "iso88591") == true); static_assert(/*comp-name*/("ut8", "utf8") == false); static_assert(/*comp-name*/("utf-80", "utf8") == false);
[编辑] 参数
a, b | - | 要比较的字符串 |
[编辑] 返回值
当两个字符串按上述比较相等时返回 true;否则返回 false。