Namespaces
Variants

std::text_encoding:: comp-name

From cppreference.net
static constexpr bool /*comp-name*/ ( std:: string_view a, std:: string_view b ) ;
(C++26부터)
( 설명 전용* )

두 문자열 a b 를 일반 리터럴 인코딩으로 인코딩된 상태에서 Unicode Charset Alias Matching 규칙에 따라 비교합니다.

두 문자열은 다음 조건을 만족할 때 왼쪽에서 오른쪽으로 비교하여 동일한 것으로 간주됩니다:

  • 모든 비-영숫자 문자 제거,
  • 모든 문자를 동일한 대소문자로 변환, 그리고
  • 숫자 접두사 바로 뒤에 오지 않는 독립적인 '0' 문자 시퀀스 제거. 숫자 접두사는 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 그렇지 않은 경우.