Namespaces
Variants
Actions

std::text_encoding::comp-name

From cppreference.com
< cpp‎ | text‎ | text encoding
staticconstexprbool/*comp-name*/(std::string_view a, std::string_view b );
(since C++26)
(exposition only*)

Compares two strings a and b encoded in ordinary literal encoding following the Unicode Charset Alias Matching rules.

Two strings are considered equal when comparing from left to right after:

  • removing all non-alphanumeric characters,
  • converting all letters to the same case, and
  • removing any standalone sequences of '0' characters that do not immediately follow a numeric prefix. A numeric prefix consists of a non-zero digit ('1' through '9') optionally followed by one or more non-alphanumeric characters.

Here are the following examples:

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);

[edit]Parameters

a, b - strings to compare

[edit]Return value

true if two strings compare equal as described above; false otherwise.

close