mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-13 01:10:24 +00:00
40 lines
878 B
C++
40 lines
878 B
C++
#include <util/str.hpp>
|
|
|
|
#include <algorithm>
|
|
#include <cstring>
|
|
#include <string>
|
|
|
|
namespace llarp
|
|
{
|
|
bool
|
|
IsFalseValue(const char* str)
|
|
{
|
|
std::string value = str;
|
|
std::transform(value.begin(), value.end(), value.begin(),
|
|
[](char ch) -> char { return std::tolower(ch); });
|
|
return value == "no" || value == "false" || value == "0";
|
|
}
|
|
|
|
bool
|
|
IsTrueValue(const char* str)
|
|
{
|
|
std::string value = str;
|
|
std::transform(value.begin(), value.end(), value.begin(),
|
|
[](char ch) -> char { return std::tolower(ch); });
|
|
return value == "yes" || value == "true" || value == "1";
|
|
}
|
|
|
|
bool
|
|
StrEq(const char* s1, const char* s2)
|
|
{
|
|
size_t sz1 = strlen(s1);
|
|
size_t sz2 = strlen(s2);
|
|
if(sz1 == sz2)
|
|
{
|
|
return strncmp(s1, s2, sz1) == 0;
|
|
}
|
|
else
|
|
return false;
|
|
}
|
|
} // namespace llarp
|