Introduce Strings::case_insensitive_ascii_starts_with();
MODIFY
include/vcpkg_Strings.h
include/vcpkg_Strings.h
@@ -65,6 +65,8 @@ namespace vcpkg::Strings
std::string ascii_to_lowercase(const std::string& input);
+ bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern);
+
template<class Container, class Transformer, class CharType>
std::basic_string<CharType> join(const CharType* delimiter, const Container& v, Transformer transformer)
{

MODIFY
src/vcpkg_Strings.cpp
src/vcpkg_Strings.cpp
@@ -110,6 +110,11 @@ namespace vcpkg::Strings
return output;
}
+ bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern)
+ {
+ return _strnicmp(s.c_str(), pattern.c_str(), pattern.size()) == 0;
+ }
+
void trim(std::string* s)
{
s->erase(std::find_if_not(s->rbegin(), s->rend(), details::isspace).base(), s->end());
@@ -137,7 +142,8 @@ namespace vcpkg::Strings
{
std::vector<std::string> output;
- if(delimiter.empty()){
+ if (delimiter.empty())
+ {
output.push_back(s);
return output;
}

Introduce Strings::case_insensitive_ascii_starts_with();