Skip to content

Commit

Permalink
use strncmp instead of find. (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanDzhabarov committed Oct 3, 2016
1 parent a6271f2 commit dfbf8c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/common/common/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bool StringUtil::endsWith(const std::string& source, const std::string& end) {
bool StringUtil::startsWith(const std::string& source, const std::string& start,
bool case_sensitive) {
if (case_sensitive) {
return source.find(start) == 0;
return strncmp(source.c_str(), start.c_str(), start.size()) == 0;
} else {
return strncasecmp(source.c_str(), start.c_str(), start.size()) == 0;
}
Expand Down

0 comments on commit dfbf8c3

Please sign in to comment.