1
0
mirror of synced 2025-02-01 04:15:50 +01:00

Update Utils.cpp

This commit is contained in:
zaphod77 2020-03-10 12:26:33 -07:00 committed by GitHub
parent 520f115aa2
commit a8c76dbcbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,6 +56,11 @@ bool ToBool(const std::string& s)
return !!Compare(s, "false", false);
}
int ToInt(const std::string& s) // handy function
{
return stoi(s); // real simple. :)
}
bool IpToByte(const char* ip, char bytes[4])
{
return (sscanf(ip, "%hhu.%hhu.%hhu.%hhu", &bytes[0], &bytes[1], &bytes[2], &bytes[3]) == 4);
@ -157,4 +162,4 @@ std::string ToNarrow(const std::wstring& wide)
std::wstring ToWide(const std::string& narrow)
{
return m_converter.from_bytes(narrow);
}
}