Skip to content

Commit

Permalink
backport bugfix from 79f3d43
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Jan 10, 2020
1 parent 2d9f843 commit fa8ca69
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mdal/mdal_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,27 @@ std::string MDAL::replace( const std::string &str, const std::string &substr, co
// http://www.cplusplus.com/faq/sequences/strings/trim/
std::string MDAL::trim( const std::string &s, const std::string &delimiters )
{
if ( s.empty() )
return s;

return ltrim( rtrim( s, delimiters ), delimiters );
}

// http://www.cplusplus.com/faq/sequences/strings/trim/
std::string MDAL::ltrim( const std::string &s, const std::string &delimiters )
{
if ( s.empty() )
return s;

return s.substr( s.find_first_not_of( delimiters ) );
}

// http://www.cplusplus.com/faq/sequences/strings/trim/
std::string MDAL::rtrim( const std::string &s, const std::string &delimiters )
{
if ( s.empty() )
return s;

return s.substr( 0, s.find_last_not_of( delimiters ) + 1 );
}

Expand Down

0 comments on commit fa8ca69

Please sign in to comment.