util/StringUtil: pass std::string_view to StringArrayContainsCase()
This commit is contained in:
parent
85b072b3d3
commit
b5d1a09010
@ -18,35 +18,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "StringUtil.hxx"
|
#include "StringUtil.hxx"
|
||||||
#include "StringView.hxx"
|
#include "StringCompare.hxx"
|
||||||
#include "CharUtil.hxx"
|
#include "CharUtil.hxx"
|
||||||
#include "ASCII.hxx"
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StringArrayContainsCase(const char *const*haystack,
|
StringArrayContainsCase(const char *const*haystack,
|
||||||
const char *needle) noexcept
|
std::string_view needle) noexcept
|
||||||
{
|
{
|
||||||
assert(haystack != nullptr);
|
assert(haystack != nullptr);
|
||||||
assert(needle != nullptr);
|
|
||||||
|
|
||||||
for (; *haystack != nullptr; ++haystack)
|
for (; *haystack != nullptr; ++haystack)
|
||||||
if (StringEqualsCaseASCII(*haystack, needle))
|
if (StringIsEqualIgnoreCase(*haystack, needle))
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
StringArrayContainsCase(const char *const*haystack,
|
|
||||||
StringView needle) noexcept
|
|
||||||
{
|
|
||||||
assert(haystack != nullptr);
|
|
||||||
assert(needle != nullptr);
|
|
||||||
|
|
||||||
for (; *haystack != nullptr; ++haystack)
|
|
||||||
if (needle.EqualsIgnoreCase(*haystack))
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <string_view>
|
||||||
struct StringView;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a string array contains the specified string.
|
* Checks whether a string array contains the specified string.
|
||||||
@ -37,12 +36,7 @@ struct StringView;
|
|||||||
gcc_pure
|
gcc_pure
|
||||||
bool
|
bool
|
||||||
StringArrayContainsCase(const char *const*haystack,
|
StringArrayContainsCase(const char *const*haystack,
|
||||||
const char *needle) noexcept;
|
std::string_view needle) noexcept;
|
||||||
|
|
||||||
gcc_pure
|
|
||||||
bool
|
|
||||||
StringArrayContainsCase(const char *const*haystack,
|
|
||||||
StringView needle) noexcept;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the specified ASCII string (0x00..0x7f) to upper case.
|
* Convert the specified ASCII string (0x00..0x7f) to upper case.
|
||||||
|
Loading…
Reference in New Issue
Block a user