util/StringUtil: add StringArrayContainsCase() overload with StringView
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2018 The Music Player Daemon Project
|
||||
* Copyright 2003-2019 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "StringUtil.hxx"
|
||||
#include "StringView.hxx"
|
||||
#include "CharUtil.hxx"
|
||||
#include "ASCII.hxx"
|
||||
|
||||
@@ -37,6 +38,20 @@ StringArrayContainsCase(const char *const*haystack,
|
||||
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 false;
|
||||
}
|
||||
|
||||
void
|
||||
ToUpperASCII(char *dest, const char *src, size_t size) noexcept
|
||||
{
|
||||
|
Reference in New Issue
Block a user