* Checks if a string is contained in another string with a locale-aware comparison that is case insensitive. * * @param str The string to search in. * @param value The string to search for. * @return True if a match was found. */
| 521 | * @return True if a match was found. |
| 522 | */ |
| 523 | [[nodiscard]] bool StrNaturalContainsIgnoreCase(std::string_view str, std::string_view value) |
| 524 | { |
| 525 | #ifdef WITH_ICU_I18N |
| 526 | int res_u = ICUStringContains(str, value, true); |
| 527 | if (res_u >= 0) return res_u > 0; |
| 528 | #endif /* WITH_ICU_I18N */ |
| 529 | |
| 530 | #if defined(_WIN32) && !defined(STRGEN) && !defined(SETTINGSGEN) |
| 531 | int res = Win32StringContains(str, value, true); |
| 532 | if (res >= 0) return res > 0; |
| 533 | #endif |
| 534 | |
| 535 | #if defined(WITH_COCOA) && !defined(STRGEN) && !defined(SETTINGSGEN) |
| 536 | int res = MacOSStringContains(str, value, true); |
| 537 | if (res >= 0) return res > 0; |
| 538 | #endif |
| 539 | |
| 540 | CaseInsensitiveStringView ci_str{ str.data(), str.size() }; |
| 541 | CaseInsensitiveStringView ci_value{ value.data(), value.size() }; |
| 542 | return ci_str.find(ci_value) != CaseInsensitiveStringView::npos; |
| 543 | } |
| 544 | |
| 545 | /** |
| 546 | * Convert a single hex-nibble to a byte. |
no test coverage detected