mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Janitor : Guard empty string
This commit is contained in:
parent
db8209d23a
commit
442abfea05
@ -28,6 +28,8 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::string RiaStdStringTools::trimString( const std::string& s )
|
std::string RiaStdStringTools::trimString( const std::string& s )
|
||||||
{
|
{
|
||||||
|
if ( s.empty() ) return s;
|
||||||
|
|
||||||
auto sCopy = s.substr( 0, s.find_last_not_of( ' ' ) + 1 );
|
auto sCopy = s.substr( 0, s.find_last_not_of( ' ' ) + 1 );
|
||||||
sCopy = sCopy.substr( sCopy.find_first_not_of( ' ' ) );
|
sCopy = sCopy.substr( sCopy.find_first_not_of( ' ' ) );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user