Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::char_traits<char>::compare,std::char_traits<wchar_t>::compare,std::char_traits<char8_t>::compare,std::char_traits<char16_t>::compare,std::char_traits<char32_t>::compare

      From cppreference.com
      <cpp‎ |string‎ |char traits
       
       
       
       
      staticint compare(const char_type* s1,const char_type* s2,
                         std::size_t count);
      (constexpr since C++17)

      Compares the firstcount characters of the character stringss1 ands2. The comparison is done lexicographically.

      Ifcount is zero, strings are considered equal.

      SeeCharTraits for the general requirements on character traits forX::compare.

      [edit]Parameters

      s1, s2 - pointers to character strings to compare
      count - the number of characters to compare from each character string

      [edit]Return value

      Negative value ifs1 isless thans2.

      0 ifs1 isequal tos2.

      Positive value ifs1 isgreater thans2.

      [edit]Complexity

      Linear incount.

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/string/char_traits/compare&oldid=158860"

      [8]ページ先頭

      ©2009-2025 Movatter.jp