azure-core
strings.hpp
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // SPDX-License-Identifier: MIT
3 
9 #pragma once
10 
11 #include <algorithm>
12 #include <string>
13 
14 namespace Azure { namespace Core { namespace _internal {
15 
20  struct StringExtensions final
21  {
22  struct CaseInsensitiveComparator final
23  {
24  bool operator()(const std::string& lhs, const std::string& rhs) const
25  {
26  return std::lexicographical_compare(
27  lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), [](char c1, char c2) {
28  return ToLower(c1) < ToLower(c2);
29  });
30  }
31  };
32 
33  static bool LocaleInvariantCaseInsensitiveEqual(
34  const std::string& lhs,
35  const std::string& rhs) noexcept;
36  static std::string const ToLower(std::string const& src) noexcept;
37  static unsigned char ToLower(unsigned char const src) noexcept;
38  static std::string const ToUpper(std::string const& src) noexcept;
39  static unsigned char ToUpper(unsigned char const src) noexcept;
40  };
41 
42 }}} // namespace Azure::Core::_internal
Azure
Azure SDK abstractions.
Definition: azure_assert.hpp:55