45#ifndef OPENMD_UTILS_CI_STRING_HPP
46#define OPENMD_UTILS_CI_STRING_HPP
53namespace OpenMD::Utils {
56 static int compare(
const char* s1_,
const char* s2_,
57 std::size_t count_)
noexcept {
58 while (count_-- != 0) {
59 if (std::toupper(*s1_) < std::toupper(*s2_))
return -1;
60 if (std::toupper(*s1_) > std::toupper(*s2_))
return 1;
69 static const char* find(
const char* p_, std::size_t count_,
70 const char& ch_)
noexcept {
71 const auto CH {std::toupper(ch_)};
73 while (count_-- != 0) {
74 if (std::toupper(*p_) == CH)
return p_;
82 static bool eq(
char a,
char b)
noexcept {
83 return std::toupper(a) == std::toupper(b);
86 static bool lt(
char a,
char b)
noexcept {
87 return std::toupper(a) < std::toupper(b);
91 template<
class OutputTraits,
class InputTraits>
92 inline std::basic_string<char, OutputTraits> traits_cast(
93 const std::basic_string<char, InputTraits>& input)
noexcept {
94 std::basic_string<char, OutputTraits> ouput {input.data(), input.size()};
98 inline std::ostream& operator<<(
99 std::ostream& os,
const std::basic_string<char, ci_char_traits>& str) {
105 using ci_string = std::basic_string<char, ci_char_traits>;