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。