From 3db31cd2ffd09990b7c2637ba646663803b7089e Mon Sep 17 00:00:00 2001 From: momo5502 Date: Fri, 23 Jun 2017 20:19:33 +0200 Subject: [PATCH] [Utils] Fix EndsWith function --- src/Utils/String.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Utils/String.cpp b/src/Utils/String.cpp index ad314e39..568629b1 100644 --- a/src/Utils/String.cpp +++ b/src/Utils/String.cpp @@ -35,11 +35,6 @@ namespace Utils 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 result; @@ -104,6 +99,11 @@ namespace Utils 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) { if (c < -1) return 0;