Skip to content

Commit

Permalink
Issue AcademySoftwareFoundation#1874 Cast to unsigned char for isspace.
Browse files Browse the repository at this point in the history
Signed-off-by: pylee <[email protected]>
  • Loading branch information
pennelee committed Oct 12, 2023
1 parent c7ad353 commit 0061ab1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/StringUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ inline std::string LeftTrim(std::string str, char c)
// Starting from the left, trim all the space characters i.e. space, tabulation, etc.
inline std::string LeftTrim(std::string str)
{
const auto it = std::find_if(str.begin(), str.end(), [](char ch) { return !std::isspace(ch); });
const auto it = std::find_if(str.begin(), str.end(), [](char ch) { return !std::isspace(static_cast<unsigned char>(ch)); });
str.erase(str.begin(), it);
return str;
}
Expand All @@ -123,7 +123,7 @@ inline std::string RightTrim(std::string str, char c)
inline std::string RightTrim(std::string str)
{
const auto it =
std::find_if(str.rbegin(), str.rend(), [](char ch) { return !std::isspace(ch); });
std::find_if(str.rbegin(), str.rend(), [](char ch) { return !std::isspace(static_cast<unsigned char>(ch)); });
str.erase(it.base(), str.end());
return str;
}
Expand Down

0 comments on commit 0061ab1

Please sign in to comment.