mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-17 18:17:32 +00:00
Introduce Strings::case_insensitive_ascii_starts_with();
This commit is contained in:
parent
53d5076f64
commit
2de9f83ff2
@ -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)
|
||||
{
|
||||
|
@ -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());
|
||||
@ -136,8 +141,9 @@ namespace vcpkg::Strings
|
||||
std::vector<std::string> split(const std::string& s, const std::string& delimiter)
|
||||
{
|
||||
std::vector<std::string> output;
|
||||
|
||||
if(delimiter.empty()){
|
||||
|
||||
if (delimiter.empty())
|
||||
{
|
||||
output.push_back(s);
|
||||
return output;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user