[Utils] Fix EndsWith function

This commit is contained in:
momo5502 2017-06-23 20:19:33 +02:00
parent 424c7e7adf
commit 3db31cd2ff

View File

@ -35,11 +35,6 @@ namespace Utils
return input; return input;
} }
bool EndsWith(std::string haystack, std::string needle)
{
return (strstr(haystack.data(), needle.data()) == (haystack.data() + haystack.size() - needle.size()));
}
std::string DumpHex(std::string data, std::string separator) std::string DumpHex(std::string data, std::string separator)
{ {
std::string result; std::string result;
@ -104,6 +99,11 @@ namespace Utils
return (haystack.size() >= needle.size() && !strncmp(needle.data(), haystack.data(), needle.size())); return (haystack.size() >= needle.size() && !strncmp(needle.data(), haystack.data(), needle.size()));
} }
bool EndsWith(std::string haystack, std::string needle)
{
return (haystack.size() >= needle.size() && !strncmp(needle.data(), haystack.data() + (haystack.size() - needle.size()), needle.size()));
}
int IsSpace(int c) int IsSpace(int c)
{ {
if (c < -1) return 0; if (c < -1) return 0;