| 42 | } |
| 43 | |
| 44 | size_t find_case_insensitive(const std::string_view &str_haystack, const std::string_view &str_needle) { |
| 45 | // courtesy of https://stackoverflow.com/a/19839371/1269661 |
| 46 | auto it = std::search( |
| 47 | str_haystack.begin(), str_haystack.end(), |
| 48 | str_needle.begin(), str_needle.end(), |
| 49 | [](char ch1, char ch2) { return std::toupper(ch1) == std::toupper(ch2); } |
| 50 | ); |
| 51 | if (it == str_haystack.end()) |
| 52 | return std::string_view::npos; |
| 53 | return it - str_haystack.begin(); |
| 54 | } |
| 55 | |
| 56 | string_case_type get_string_case_type(const std::wstring_view &sv) { |
| 57 | if (sv.empty()) |