mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
The file had DOS line endings (\t\n) which where not properly trimmed on linux. Fixes #8652.
This commit is contained in:
committed by
GitHub
parent
80234ca105
commit
86ea679871
@@ -23,15 +23,32 @@
|
||||
#include <cctype>
|
||||
#include <charconv>
|
||||
|
||||
const std::string WHITESPACE = " \n\r\t\f\v";
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaStdStringTools::leftTrimString( const std::string& s )
|
||||
{
|
||||
size_t start = s.find_first_not_of( WHITESPACE );
|
||||
return ( start == std::string::npos ) ? "" : s.substr( start );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaStdStringTools::rightTrimString( const std::string& s )
|
||||
{
|
||||
size_t end = s.find_last_not_of( WHITESPACE );
|
||||
return ( end == std::string::npos ) ? "" : s.substr( 0, end + 1 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaStdStringTools::trimString( const std::string& s )
|
||||
{
|
||||
auto sCopy = s.substr( 0, s.find_last_not_of( ' ' ) + 1 );
|
||||
sCopy = sCopy.substr( sCopy.find_first_not_of( ' ' ) );
|
||||
|
||||
return sCopy;
|
||||
return rightTrimString( leftTrimString( s ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user