# std::text_encoding::comp-name

> C++ Atlas: `cppatlas.com/w/cpp/text/text_encoding/comp-name` | Source: https://en.cppreference.com/w/cpp/text/text_encoding/comp-name | Domain: Text processing | Standards: C++26

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

## Official Specification Summary (cppreference)

```cpp
static constexpr bool /*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:

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

### Parameters

- `a, b` - strings to compare

### Return value

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

---
Attribution: content from https://en.cppreference.com/w/cpp/text/text_encoding/comp-name (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.